88c2a06024
JetBrains' JediTerm — the terminal embedded in PyCharm, IDEA, CLion, WebStorm, GoLand, etc. — advertises mouse support but forwards SGR mouse-event escape sequences as raw input characters rather than interpreting them. Users see the composer auto-fill with garbled characters when they move the mouse over the TUI window. The workaround was already a one-flag fix (`--no-mouse-capture` or `[tui] mouse_capture = false` in config) but discovering it required finding a maintainer comment on a related issue. Auto-detect via `TERMINAL_EMULATOR=JetBrains-JediTerm` (the env var JediTerm sets) and default `mouse_capture` off for that environment, mirroring the existing Windows handling. Explicit `--mouse-capture` or `[tui] mouse_capture = true` still wins, so power users who don't hit the issue can opt back in. Implementation: - `default_mouse_capture_enabled` now takes `terminal_emulator: Option<&str>` so the function is pure and trivially testable. The CLI entry point reads the env var once and passes it through. - `should_use_mouse_capture` keeps the same public signature; tests call `should_use_mouse_capture_with` which takes the env explicitly, removing test sensitivity to the host's actual TERMINAL_EMULATOR. - Match is `eq_ignore_ascii_case` because JetBrains has occasionally varied the casing across releases. Tests: - 4 new tests covering JetBrains default-off, case-insensitive match, CLI override, and config-file override. - Existing 6 mouse-capture tests retained, all passing. - `cargo test -p deepseek-tui --bin deepseek-tui --all-features terminal_mode_tests --locked` → 10/10 pass. - `cargo clippy -p deepseek-tui --bins --all-features --locked -- -D warnings` clean. - `cargo fmt --all -- --check` clean. Docs in `docs/MODES.md` and `docs/CONFIGURATION.md` updated. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>