fix(tui): default mouse capture off on Windows (#785)

This commit is contained in:
Hunter Bown
2026-05-05 22:40:31 -05:00
committed by GitHub
parent 0fded51824
commit 3af6ef6f69
3 changed files with 18 additions and 3 deletions
+16 -1
View File
@@ -135,6 +135,7 @@ struct Cli {
no_alt_screen: bool,
/// Enable TUI mouse capture for internal scrolling and transcript selection
/// (default off on Windows)
#[arg(long = "mouse-capture", conflicts_with = "no_mouse_capture")]
mouse_capture: bool,
@@ -3339,7 +3340,11 @@ fn should_use_mouse_capture(cli: &Cli, config: &Config, use_alt_screen: bool) ->
.tui
.as_ref()
.and_then(|tui| tui.mouse_capture)
.unwrap_or(true)
.unwrap_or_else(default_mouse_capture_enabled)
}
fn default_mouse_capture_enabled() -> bool {
!cfg!(windows)
}
fn is_zellij() -> bool {
@@ -4026,6 +4031,7 @@ mod terminal_mode_tests {
}
#[test]
#[cfg(not(windows))]
fn mouse_capture_defaults_on_when_alternate_screen_is_active() {
let cli = parse_cli(&["deepseek"]);
let config = Config::default();
@@ -4033,6 +4039,15 @@ mod terminal_mode_tests {
assert!(should_use_mouse_capture(&cli, &config, true));
}
#[test]
#[cfg(windows)]
fn mouse_capture_defaults_off_on_windows_when_alternate_screen_is_active() {
let cli = parse_cli(&["deepseek"]);
let config = Config::default();
assert!(!should_use_mouse_capture(&cli, &config, true));
}
#[test]
fn no_mouse_capture_flag_disables_mouse_capture() {
let cli = parse_cli(&["deepseek", "--no-mouse-capture"]);
+1 -1
View File
@@ -391,7 +391,7 @@ If you are upgrading from older releases:
`false`. When `true`, the notification body includes the elapsed
duration and the turn's USD cost.
- `tui.alternate_screen` (string, optional): `auto`, `always`, or `never`. `auto` disables the alternate screen in Zellij; `--no-alt-screen` forces inline mode. Set `never` or run with `--no-alt-screen` when you want real terminal scrollback.
- `tui.mouse_capture` (bool, optional, default `true` when the alternate screen is active): enable internal mouse scrolling, transcript selection, and right-click context actions. TUI-owned drag selection copies only user/assistant transcript text. Set this to `false` or run with `--no-mouse-capture` for raw terminal selection.
- `tui.mouse_capture` (bool, optional, default `true` on non-Windows terminals and `false` on Windows when the alternate screen is active): enable internal mouse scrolling, transcript selection, and right-click context actions. TUI-owned drag selection copies only user/assistant transcript text. Set this to `false` or run with `--no-mouse-capture` for raw terminal selection; set it to `true` or run with `--mouse-capture` to opt in on Windows.
- `tui.terminal_probe_timeout_ms` (int, optional, default `500`): startup terminal-mode probe timeout in milliseconds. Values are clamped to `100..=5000`; timeout emits a warning and aborts startup instead of hanging indefinitely.
- `tui.osc8_links` (bool, optional, default `true`): emit OSC 8 escape sequences around URLs in transcript output so terminals that support them (iTerm2, Terminal.app 13+, Ghostty, Kitty, WezTerm, Alacritty, recent gnome-terminal/konsole) render them as Cmd+click hyperlinks. Terminals without OSC 8 support render the plain URL and ignore the escape. Set `false` for terminals that misrender the sequence; selection/clipboard output always strips the escapes.
- `hooks` (optional): lifecycle hooks configuration (see `config.example.toml`).
+1 -1
View File
@@ -84,7 +84,7 @@ Run `deepseek --help` for the canonical list. Common flags:
- `-c, --continue`: resume the most recent session
- `--max-subagents <N>`: clamp to `1..=20`
- `--no-alt-screen`: run inline without the alternate screen buffer
- `--mouse-capture` / `--no-mouse-capture`: opt in or out of internal mouse scrolling, transcript selection, and right-click context actions. Mouse capture is enabled by default so drag selection copies only user/assistant transcript text; hold Shift while dragging or use `--no-mouse-capture` for raw terminal selection.
- `--mouse-capture` / `--no-mouse-capture`: opt in or out of internal mouse scrolling, transcript selection, and right-click context actions. Mouse capture is enabled by default on non-Windows terminals so drag selection copies only user/assistant transcript text; hold Shift while dragging or use `--no-mouse-capture` for raw terminal selection. On Windows it defaults off to avoid CMD/terminal mouse escape sequences being inserted into the prompt; use `--mouse-capture` to opt in.
- `--profile <NAME>`: select config profile
- `--config <PATH>`: config file path
- `-v, --verbose`: verbose logging