Repository navigation
fix(cli): keep hyperlink terminators unescaped in text rows - #234
Merged
Merged
Conversation
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
When mops writes to a terminal, text rows link node references to MPS with OSC 8.
textRowescaped the whole column, including the link markup, so eachESC \terminator becameESC \\and terminals such as iTerm2 printed a stray\before and after the reference.A row column is now a
TextColumn(text, link).textRowescapes only the text and then wraps it in the link markup. The URL is built from the original reference.Paths changed (all text rows that hold a node reference):
ls/listnode and root rows (ListRenderer)findresult rows: node, usage owner, and parent columns (find/resultRendering.kt)checkfinding rows (check/checkResultRendering.kt)Paths left as is:
findempty-result metadata line (# no … in the subtree of X <ref>,find/emptyResult.kt): not a text row and not escaped, so its link was already correct. It goes throughrenderNodeReference, which now usesnodeReferenceColumn.find --refs-only(find/SearchCommand.kt): never links (withoutLink()).diagnoseandget modulerows: no node references.Whether references are linked is now part of
NodeReferenceFormat, so renderers take one value instead of a format plus ahyperlinksflag:SERIALIZEDLINKED(new)URLNodeReferenceFormat.default()is the one console check:LINKEDwhen stdout is a console,SERIALIZEDotherwise.MopsCommanduses it unless--refs-as-urlsis given.find --refs-onlyusesformat.withoutLink(), so it stays plain.Evidence
Before:
lsrow with hyperlinks on (bytes from the new test's failing run):After:
New
HyperlinkedTextRowsTest(hyperlinks on):ls,find(node and parent) andcheckrows keepESC \unescaped; a tab in a reference is escaped as\tin the shown text and percent-encoded (%09) in the URL. All 4 failed before the fix and pass after.SearchCommandTest(all fourfindsubcommands): withLINKED, text rows carry the link and--refs-onlyprints plain references. The--refs-onlytest fails whenwithoutLink()is removed.Ran
:cli:test(381 tests, 0 failures),detektMain,checkReference,checkExamples: all pass.detektTestreports 5 issues that are also onmain, in code this PR does not change (CliTestFixtures.kt,RecordingDaemon.kt, theSearchSubcommandconstructor inSearchCommandTest.kt,checkResponseFixtures.kt,GradleHomeDiscoveryTest.kt). Full./gradlew checkwas not run.Merge Danger
Blast Radius: terminal-only
Only output to a console changes; piped output and JSON are the same as before.