Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Checked checkboxes in task descriptions that were created via iCalendar sync (or otherwise contain CRLF
\r\nline endings) stayed visible even when the "Hide completed tasks" filter was enabled.Root cause
filterCheckedCheckboxessplit content withsplit('\n')and matched each line usingRegex.matchEntire(). In Kotlin,.*does not consume a trailing carriage return (\r), so lines ending in\r\nfailed to matchmatchEntire(). As a result, checked items on CRLF lines slipped through the filter.Changes
app/src/main/java/at/techbee/jtx/ui/reusable/components/InteractiveMarkdown.ktCharSequence.lines()instead ofsplit('\n')(infilterCheckedCheckboxes,parseMarkdownSegments, andupdateCheckboxState) — this safely strips line-ending delimiters.checkboxLineRegexto optionally consume a trailing\ras a safeguard.-,*,+), not just-.updateCheckboxState(previously always rewrote it as-).Tests
app/src/test/.../InteractiveMarkdownTest.kt— added unit tests covering CRLF handling, multi-marker (*,+) support, and marker preservation on toggle.