diff --git a/CHANGELOG.md b/CHANGELOG.md index 24d0fbef..4962a370 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -148,6 +148,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 the user-level array wholesale (the typical "merge" pattern is for users who want both — they list `~/global.md` inside the project array). Documented in `config.example.toml`. +- **Keyboard-enhancement flags pop on suspend paths too** (#443 + follow-up) — `pause_terminal` (Ctrl+Z / shell-suspend) and + `external_editor::spawn_editor_for_input` (composer `$EDITOR` + launch) now pop the flags before handing the terminal to the + child process, matching the existing shutdown and panic-hook + paths. Defense-in-depth: if a future code path enables the + flags explicitly, the suspend handlers won't leak them to a + Vim / less / shell child that hasn't asked for them. - **RLM tool family** (#512) — `rlm` tool cards map to `ToolFamily::Rlm` and render `rlm`, not `swarm`. Stale "swarm" wording cleaned out of docs / comments / tests. diff --git a/crates/tui/src/tui/external_editor.rs b/crates/tui/src/tui/external_editor.rs index 3ae62c2a..b9fcac0a 100644 --- a/crates/tui/src/tui/external_editor.rs +++ b/crates/tui/src/tui/external_editor.rs @@ -15,7 +15,10 @@ use std::io::{self, Stdout, Write}; use std::process::Command; use crossterm::{ - event::{DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture}, + event::{ + DisableBracketedPaste, DisableMouseCapture, EnableBracketedPaste, EnableMouseCapture, + PopKeyboardEnhancementFlags, + }, execute, terminal::{EnterAlternateScreen, LeaveAlternateScreen, disable_raw_mode, enable_raw_mode}, }; @@ -125,6 +128,10 @@ pub fn spawn_editor_for_input( current: &str, ) -> io::Result { // 1. Suspend. + // #443: pop keyboard enhancement flags first so the editor + // process doesn't inherit a half-configured input mode. Best- + // effort — matches the shutdown / panic paths in main.rs. + let _ = execute!(terminal.backend_mut(), PopKeyboardEnhancementFlags); let _ = disable_raw_mode(); if use_bracketed_paste { let _ = execute!(terminal.backend_mut(), DisableBracketedPaste); diff --git a/crates/tui/src/tui/ui.rs b/crates/tui/src/tui/ui.rs index a1b7b08a..eed3a6b3 100644 --- a/crates/tui/src/tui/ui.rs +++ b/crates/tui/src/tui/ui.rs @@ -5162,6 +5162,11 @@ fn pause_terminal( use_mouse_capture: bool, use_bracketed_paste: bool, ) -> Result<()> { + // #443: pop keyboard enhancement flags before handing the terminal + // to a child process so it doesn't inherit a half-configured input + // mode. Best-effort — terminals that didn't accept the flags + // silently ignore the pop. Matches the shutdown and panic paths. + let _ = execute!(terminal.backend_mut(), PopKeyboardEnhancementFlags); disable_raw_mode()?; if use_alt_screen { execute!(terminal.backend_mut(), LeaveAlternateScreen)?;