-
Notifications
You must be signed in to change notification settings - Fork 362
tui: Fix URL clicks #2823
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
tui: Fix URL clicks #2823
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -330,6 +330,10 @@ func (m *model) handleMouseClick(msg tea.MouseClickMsg) (layout.Model, tea.Cmd) | |
| } | ||
| } | ||
|
|
||
| if url := m.urlAt(line, col); url != "" { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [MEDIUM] Drag-select starting on URL text is no longer possible Because the The previous design handled this correctly: With the new approach any press over URL text immediately dispatches Suggestion: Either defer URL opening to |
||
| return m, core.CmdHandler(messages.OpenURLMsg{URL: url}) | ||
| } | ||
|
|
||
| clickCount := m.selection.detectClickType(line, col) | ||
|
|
||
| switch clickCount { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[MEDIUM] URL may be opened twice on a plain click (double-open risk)
handleMouseClicknow opens the URL and returns at line 333 — beforem.selection.start(line, col)is reached. This meansselection.startLine/startColare NOT updated for this click.In
handleMouseRelease(line 434) the existing guardif line == m.selection.startLine && col == m.selection.startColstill triggers a secondOpenURLMsg. If the release coordinates happen to match the previous click'sstartLine/startCol(e.g., the user clicks a URL at the same cell twice in a row, orstartLine/startColinitialise to 0 and the URL is in the top-left area), the URL will be opened a second time.The old code in
handleMouseReleasethat performs the sameurlAtlookup was not removed by this PR; the two paths are now additive rather than mutually exclusive.Suggestion: Remove (or gate) the
urlAtbranch insidehandleMouseReleasenow that URL opening is handled inhandleMouseClick, so each click triggers at most oneOpenURLMsg.