mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-08-07 07:45:54 +00:00
* fix(cli): add ui.mouseTracking setting to restore right-click and URL clicks
VP mode (default since 0.21.1) enables SGR mouse tracking (?1002h)
which captures ALL mouse events including right-click and left-click
on OSC 8 hyperlinks. The terminal can no longer handle these
natively — right-click context menus and clickable URL links stop
working.
Add a `ui.mouseTracking` boolean setting (default: true) that gates
SGR mouse tracking in useMouseEvents. When set to false, mouse
tracking is disabled entirely, restoring terminal-native right-click
and OSC 8 hyperlink handling. The trade-off is that mouse wheel
scrolling and scrollbar dragging in the VP viewport stop working;
keyboard scrolling (Up/Down/PgUp/PgDn) still works.
Users who need right-click or URL clicking can set:
"ui": { "mouseTracking": false }
Fixes the regression reported in #8003 (right-click broken) and
the follow-up report (URL link clicks broken) after 0.21.1.
* fix(cli): regenerate mouseTracking schema and clarify setting scope (#8198)
* fix(cli): scope ui.mouseTracking to the TUI and document it (#8198)
* fix(cli): handle hyperlink clicks in VP mode via onContentClick
When SGR mouse tracking is active (VP mode default), the terminal
cannot handle OSC 8 hyperlink clicks natively. Add an onContentClick
callback to ScrollableList that fires on left-press in non-scrollbar
areas. MainContent implements this callback by extracting hyperlink
regions from the clicked item's text (parsing markdown links and
bare URLs with visual column tracking) and opening the URL at the
click position via the platform's open/xdg-open/start command.
This allows URL clicks to work in VP mode without disabling mouse
tracking, so mouse wheel scrolling and scrollbar dragging continue
to work simultaneously.
New file: packages/cli/src/ui/utils/hyperlink-click.ts
- extractHyperlinkRegions(): parses markdown links and bare URLs
from raw text, computing visual column positions
- findUrlAtColumn(): maps a click column to a URL
- openUrl(): opens a URL via the platform's default handler
* fix(cli): remove broken hyperlink-click feature from VP mode (#8198)
Remove the hyperlink-click feature (hyperlink-click.ts, handleContentClick,
onContentClick) which had three critical defects identified in review:
1. Command injection on Windows: openUrl used child_process.exec with shell
string interpolation, where single-quote escaping is ineffective against
cmd.exe metacharacters (&, |, ^, ;).
2. Non-functional coordinate mapping: handleContentClick used raw 1-based
SGR terminal screen coordinates directly as item indices into
allVirtualItems, without the scroll-offset and frame-anchor transforms
that every other mouse consumer applies.
3. Wrong visual-column accounting: extractHyperlinkRegions counted raw
markdown characters (including **bold**, *italic*, ~~strikethrough~~
markers) that InlineMarkdownRenderer strips, causing column drift.
The ui.mouseTracking setting (the PR's core purpose) is unaffected and
remains fully functional. A properly designed click-to-open feature can
be added in a follow-up with correct coordinate transforms, renderer-aware
column parsing, and openBrowserSecurely for safe URL launching.
* docs(cli): cross-reference ui.mouseTracking in useTerminalBuffer descriptions (#8198)
* fix(cli): document mouseTracking tradeoffs and hide showScrollbar in serve mode (#8198)
* docs(cli): clarify mouseTracking tradeoffs in shortcuts and settings (#8198)
Address review feedback: note that mouse-wheel scrolling requires ui.mouseTracking in the keyboard-shortcuts table, the tmux trackpad section, and troubleshooting; add the missing ui.showScrollbar row to the settings reference; and pin the mouseTracking schema fields (requiresRestart: false) in settingsSchema.test.ts.
* fix(cli): make mouseTracking restart-scoped and gate mouse affordances (#8198)
ui.mouseTracking declared requiresRestart: false but nothing propagates a
settings write to the refcounted SGR mouse mode: the SettingsContext value
is a single LoadedSettings created outside React with no change emitter, so
a subscriber that never re-renders (e.g. a memoized completed thought block)
keeps ?1002h active and right-click stays broken even with the setting off.
Mark it requiresRestart: true, matching ui.useTerminalBuffer, and drop the
runtime-toggle test whose own comment admitted it did not prove the flip
lands.
Add a shared useMouseTrackingEnabled hook and route the useMouseEvents gate
and the mouse-dependent affordances through it — the history-item "click to
expand" hint, the selection-list hover controller, and prompt
click-to-position — so they read one source and no longer advertise a dead
interaction when mouseTracking is disabled.
* test(cli): add component-level mouseTracking affordance gate tests (#8198)
* fix(cli): address review feedback on mouseTracking PR (#8198)
- Rewrite BaseSelectionList mouse test to mock RowMouseController and
assert mount/unmount directly, pinning the component-level gate
instead of the downstream useMouseEvents escape writes
- Add troubleshooting entry for right-click/links/selection symptoms
- Add useTerminalBuffer pairing advice to settings.md mouseTracking row
---------
Co-authored-by: qwen-code-dev-bot <qwen-code-dev-bot@users.noreply.github.com>
Co-authored-by: Qwen Code Bot <qwen-code-bot@users.noreply.github.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Co-authored-by: Qwen Code Autofix <qwen-code-autofix@users.noreply.github.com>
|
||
|---|---|---|
| .. | ||
| _meta.ts | ||
| tos-privacy.md | ||
| troubleshooting.md | ||
| Uninstall.md | ||