Repository navigation
fix: hide a link's title while the link is concealed - #594
Merged
Merged
Conversation
Inline links with a title ([text](url "title")) rendered the title as prose because only the LinkMark and URL children were hidden. While hidden, the gap between the destination and the closing paren is now hidden too. A gap that crosses a line break stays visible: a replace over a line break is illegal from a ViewPlugin and would swallow a quote mark.
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.
Summary
A link with a title (
[text](https://e.com "My title")) showed its title as body text (see text "My title" end) while the caret was elsewhere. The title, and the whitespace around it, now hide together with the rest of the link syntax. When the caret is inside the link, the full source still shows as before.Changes
link-reveal.ts: while the link is hidden, also hide the gap from the end of the destination to the closing). This covers the"…",'…'and(…)title forms and<…>destinations.>). The provider runs in a ViewPlugin, CodeMirror rejects a replace over a line break there, and hiding the gap would also hide the quote mark. This leftover case is logged as a LOW TODO.cm-decoration-link.test.ts: pins the hidden and revealed rendering for every title form, the exact range of the hidden gap, and that no hide decoration crosses a line break.Related
Test Plan
cm-decoration-link.test.tswere red (hide for"…"/'…'/(…)/<…>destinations, plus the exact gap range). All 5 pass after it. The reveal tests pass both before and after, so they guard against regressions.\n. Without thelineAtguard, the gap"\n"in[t](u\n"x")would be hidden and the test would fail.test/webview/decorations+cm-link-*: 775 passed. Fullpnpm test:unit/test:browservia parallel-checks: PASS. In the first run,cm-image-field.test.tsfailed once under full-suite load; it passed when run alone and on the rerun. It does not touch link code.pnpm compileandpnpm lintare green.