diff --git a/crates/tui/src/main.rs b/crates/tui/src/main.rs index bf633c15..9dd048d6 100644 --- a/crates/tui/src/main.rs +++ b/crates/tui/src/main.rs @@ -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"]); diff --git a/docs/CONFIGURATION.md b/docs/CONFIGURATION.md index b30e9ff1..d97a839f 100644 --- a/docs/CONFIGURATION.md +++ b/docs/CONFIGURATION.md @@ -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`). diff --git a/docs/MODES.md b/docs/MODES.md index 2864640e..34ff218b 100644 --- a/docs/MODES.md +++ b/docs/MODES.md @@ -84,7 +84,7 @@ Run `deepseek --help` for the canonical list. Common flags: - `-c, --continue`: resume the most recent session - `--max-subagents `: 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 `: select config profile - `--config `: config file path - `-v, --verbose`: verbose logging