Repository navigation
Keep a marker outside a table where the selection put it - #93
Merged
Merged
Conversation
When one end of a selection is in a table, the other end was trimmed along with it, and leading whitespace runs across lines. A selection starting on the blank line above a heading put its marker in front of the heading's ##, and one ending after a heading's "## " put it before the space. Either way the line stopped being a heading, and a table that opens under the heading stopped rendering. Repair moved older anchors the same way. A list item's bullet broke the same way. The trim still decides whether an end belongs to a table, but a marker outside every table now stays where the selection put it, as it did before #82. Two trims stay: a start on a table's own line moves off it, and an end whose whitespace runs onto later lines comes back to its text.
Pressing End on a table's last row and then Shift+Down starts a selection past the row's closing pipe. The trim carried that start across the blank line onto the next block, so a heading or list item there still got a marker in front of its markup. A start on a table's own line now goes inside the nearest cell, which adds no table text to the comment, and only falls back to the trimmed start when the table has no cell that can hold a marker.
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.
Follow-up to #82, fixing a regression it introduced. 0.1.15 doesn't have this bug, but the next release would.
When one end of a selection is in a table,
clampToTableCellstrimmed the other end too, and leading whitespace can span lines:<!--c:id-->## Plan.##wrote##<!--/c:id--> Next.-<!--/c:id--> item.<!--c:id-->## Nexton the heading below.Either way the line stopped being a heading or list item. A table that opens directly under that heading stopped rendering too. Repair moved an older anchor's marker onto the heading the same way, then reported "Repaired 1 table comment."
The trim still decides whether an end belongs to a table. Where the markers go now:
Testing
npm run checkpasses (295 tests). Eight new tests, all failing onmain:##;Every existing table-anchoring test passes unchanged.
Obsidian, starting from the blank line above
## Plan: the comment kept the heading and all three rows.Obsidian, starting past the last row's pipe and ending in a second table under
## Next: both tables rendered with all their rows and the heading stayed a heading.Reviews:
mainand 0.1.15. It found no case where this PR breaks a table, heading, list or fence that 0.1.15 didn't also break, and no crashes or lost text.Known, not fixed here: a selection starting at the very end of a closing code fence,
---or===line still writes its marker there and breaks that line. 0.1.15 does the same, and so does every comment onmainthat doesn't touch a table. Onlymain's unreleased table code avoided it, by trimming the start forward, which is what broke headings and lists. Fixing it means changing where every comment puts its markers next to such lines, so it's a separate change.