Fix implicit-link boundaries and link cursor flicker - #650
Conversation
|
The issue with the "at" is that it sounds like it might be a valid file reference, and I can imagine other strings that we could argue whether they should be part of it or not. I wonder if we do need a different way of detecting these links. |
migueldeicaza
left a comment
There was a problem hiding this comment.
Thank you for taking the time to send these along - they look wonderful.
I am still mulling over the regex change, and whether we should do something to make this configurable instead or extend the probing infrastructure - perhaps we should validate the existence (it would only work for local mode)
|
|
||
| func linkCursor(at position: Position, hasCommandModifier: Bool) -> NSCursor | ||
| { | ||
| guard let match = terminal.linkMatch(at: .buffer(position), mode: .explicitAndImplicit), |
There was a problem hiding this comment.
This needs to use withTerminal, as we are now multi-threaded. I am
|
|
||
| func linkCursor(at position: Position, hasCommandModifier: Bool) -> NSCursor | ||
| { | ||
| guard let match = terminal.linkMatch(at: .buffer(position), mode: .explicitAndImplicit), |
There was a problem hiding this comment.
Additionally, the same call always uses .explicitAndImplicit. With the default .hoverWithModifier mode, it runs the full implicit-link regex even when Command is not pressed. When Command is pressed, updateHoverLink performs the lookup first, and linkCursor immediately performs it again. Use implicitLinkCouldBeVisible to select the mode, or reuse the result from updateHoverLink.
Summary
at f455181Terminal emulators pad every row with blank cells. Treating those cells as part of a link makes the hover underline and click target extend to the right edge. Prose attribution after a path likewise must not become part of the path. Separately, SwiftTerm's unconditional I-beam in
cursorUpdate(with:)competed with host link-hover handling and caused rapid cursor flicker.Tests
swift test --filter GhosttyImplicitLinkDetectionTestsswift test --filter MacDefaultLinkTests