Skip to content

Hide ticked checkboxes when filtering completed tasks - #2403

Open
mcepl wants to merge 2 commits into
TechbeeAT:developfrom
openSUSE-Python:hide_ticked_checkboxes
Open

mcepl wants to merge 2 commits into
TechbeeAT:developfrom
openSUSE-Python:hide_ticked_checkboxes

Conversation

@mcepl

@mcepl mcepl commented Sep 18, 2026

Copy link
Copy Markdown
Contributor

Problem

Checked checkboxes in task descriptions that were created via iCalendar sync (or otherwise contain CRLF \r\n line endings) stayed visible even when the "Hide completed tasks" filter was enabled.

Root cause

filterCheckedCheckboxes split content with split('\n') and matched each line using Regex.matchEntire(). In Kotlin, .* does not consume a trailing carriage return (\r), so lines ending in \r\n failed to match matchEntire(). As a result, checked items on CRLF lines slipped through the filter.

Changes

app/src/main/java/at/techbee/jtx/ui/reusable/components/InteractiveMarkdown.kt

  • Use CharSequence.lines() instead of split('\n') (in filterCheckedCheckboxes, parseMarkdownSegments, and updateCheckboxState) — this safely strips line-ending delimiters.
  • Update checkboxLineRegex to optionally consume a trailing \r as a safeguard.
  • Expand the checkbox regex to accept all standard Markdown list markers (-, *, +), not just -.
  • Preserve the original list marker when toggling a task in updateCheckboxState (previously always rewrote it as -).
  • Adjusted regex capture-group indices accordingly.

Tests

app/src/test/.../InteractiveMarkdownTest.kt — added unit tests covering CRLF handling, multi-marker (*, +) support, and marker preservation on toggle.

mcepl added 2 commits June 13, 2026 11:20
This improvement enhances the "Hide completed tasks" feature by also
filtering out ticked Markdown checkboxes in task descriptions/summaries
when the list filter is active. This keeps the task list clean and
focused on pending items, while ensuring that all checkboxes remain
visible and interactive in the task detail view.

- Add filterCheckedCheckboxes() utility to InteractiveMarkdown.kt
- Update all ListCard variants to support selective hiding of done
  checkboxes
- Propagate the isExcludeDone setting from ListScreens to card
  components
- Add unit tests for the filtering logic in InteractiveMarkdownTest.kt
…arkdown list markers

* Fix checkbox parsing and filtering under CRLF line endings (\r\n),
  which are common in iCalendar synced descriptions.
  The previous implementation split the description by '\n' and matched
  using Regex.matchEntire().
  Because `.*` in Kotlin regex does not consume trailing carriage
  returns (\r), matchEntire() failed to match lines ending in CRLF,
  causing checked checkboxes in synced tasks to remain visible even when
  the "Hide completed tasks" filter was active.
  This is resolved by using `CharSequence.lines()` instead of
  `split('\n')`, which safely removes line-ending delimiters, and
  updating the regex to optionally consume trailing `\r` as a safeguard.
* Expand the checkbox line regex to support other standard Markdown list
  markers (`*` and `+` in addition to `-`).
* Ensure `updateCheckboxState` preserves the original list marker when
  toggling task state.
* Add comprehensive unit tests in `InteractiveMarkdownTest` verifying
  CRLF handling, multi-marker support, and preservation of markers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant