ππΌββοΈ The blackboard for coding agents - agentic development environment for claude code, codex, cursor, opencode, grok and more.
Rust adeai-agentsclaudeclaude-codecodexcursorgeminigrokopencodespec-driven-developmentvibe-codingvim
fix: forward Alt modifier in shell popup key forwarding
fynnfluegge44553e61986c
diff --git a/src/tui/app.rs b/src/tui/app.rsindex 34663e7..8e81434 100644--- a/src/tui/app.rs+++ b/src/tui/app.rs@@ -3165,7 +3165,7 @@ impl App {}_ => {// Forward all other keys to tmux window (including Esc)- send_key_to_tmux(&window_name, key.code, self.state.tmux_ops.as_ref());+ send_key_to_tmux(&window_name, key, self.state.tmux_ops.as_ref());// After sending a key, refresh content to show the resultpopup.cached_content = capture_tmux_pane_with_history(&window_name,@@ -3180,14 +3180,9 @@ impl App {fn handle_paste(&mut self, text: String) -> Result<()> {// Shell popup open: forward paste to the tmux pane with proper bracketed paste sequences- if let Some(ref mut popup) = self.state.shell_popup {+ if let Some(ref popup) = self.state.shell_popup {let window_name = popup.window_name.clone();let _ = self.state.tmux_ops.paste_text(&window_name, &text);- popup.cached_content = capture_tmux_pane_with_history(- &window_name,- 500,- self.state.tmux_ops.as_ref(),- );return Ok(());}@@ -5779,7 +5774,7 @@ impl App {match self.terminal.backend_mut() {AppBackend::Crossterm(backend) => {let _ = disable_raw_mode();- let _ = execute!(backend, LeaveAlternateScreen);+ let _ = execute!(backend, LeaveAlternateScreen, DisableBracketedPaste);}#[cfg(feature = "test-mocks")]AppBackend::Test(_) => {}@@ -5801,7 +5796,7 @@ impl App {match self.terminal.backend_mut() {AppBackend::Crossterm(backend) => {enable_raw_mode()?;- execute!(backend, EnterAlternateScreen)?;+ execute!(backend, EnterAlternateScreen, EnableBracketedPaste)?;}#[cfg(feature = "test-mocks")]AppBackend::Test(_) => {}@@ -7092,8 +7087,15 @@ fn push_changes_to_existing_pr(}/// Send a key to a tmux pane-fn send_key_to_tmux(window_name: &str, key: KeyCode, tmux_ops: &dyn TmuxOperations) {- let key_str = match key {+fn send_key_to_tmux(+ window_name: &str,+ key: crossterm::event::KeyEvent,+ tmux_ops: &dyn TmuxOperations,+) {+ use crossterm::event::KeyModifiers;+ let has_alt = key.modifiers.contains(KeyModifiers::ALT);++ let base = match key.code {KeyCode::Char(c) => c.to_string(),KeyCode::Enter => "Enter".to_string(),KeyCode::Esc => "Escape".to_string(),@@ -7113,6 +7115,12 @@ fn send_key_to_tmux(window_name: &str, key: KeyCode, tmux_ops: &dyn TmuxOperatio_ => return,};+ let key_str = if has_alt {+ format!("M-{}", base)+ } else {+ base+ };+let _ = tmux_ops.send_keys_literal(window_name, &key_str);}diff --git a/src/tui/app_tests.rs b/src/tui/app_tests.rsindex ad5d9fc..45b877f 100644--- a/src/tui/app_tests.rs+++ b/src/tui/app_tests.rs@@ -697,7 +697,11 @@ fn test_send_key_to_tmux_char() {.times(1).returning(|_, _| Ok(()));- send_key_to_tmux("test-window", KeyCode::Char('a'), &mock_tmux);+ send_key_to_tmux(+ "test-window",+ crossterm::event::KeyEvent::new(KeyCode::Char('a'), crossterm::event::KeyModifiers::NONE),+ &mock_tmux,+ );}/// Test sending Enter key to tmux@@ -715,7 +719,11 @@ fn test_send_key_to_tmux_enter() {.times(1).returning(|_, _| Ok(()));- send_key_to_tmux("test-window", KeyCode::Enter, &mock_tmux);+ send_key_to_tmux(+ "test-window",+ crossterm::event::KeyEvent::new(KeyCode::Enter, crossterm::event::KeyModifiers::NONE),+ &mock_tmux,+ );}/// Test sending special keys to tmux@@ -733,7 +741,11 @@ fn test_send_key_to_tmux_special_keys() {).returning(|_, _| Ok(()));- send_key_to_tmux("win", KeyCode::Esc, &mock_tmux);+ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::Esc, crossterm::event::KeyModifiers::NONE),+ &mock_tmux,+ );// Test Backspacelet mut mock_tmux2 = MockTmuxOperations::new();@@ -745,7 +757,11 @@ fn test_send_key_to_tmux_special_keys() {).returning(|_, _| Ok(()));- send_key_to_tmux("win", KeyCode::Backspace, &mock_tmux2);+ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::Backspace, crossterm::event::KeyModifiers::NONE),+ &mock_tmux2,+ );}/// Test sending function key to tmux@@ -759,7 +775,73 @@ fn test_send_key_to_tmux_function_key() {.with(mockall::predicate::eq("win"), mockall::predicate::eq("F5")).returning(|_, _| Ok(()));- send_key_to_tmux("win", KeyCode::F(5), &mock_tmux);+ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::F(5), crossterm::event::KeyModifiers::NONE),+ &mock_tmux,+ );+}++/// Test Alt+Left and Alt+Right send M-Left / M-Right (word-boundary navigation)+#[test]+#[cfg(feature = "test-mocks")]+fn test_send_key_to_tmux_alt_arrow_keys() {+ let mut mock_tmux = MockTmuxOperations::new();+ mock_tmux+ .expect_send_keys_literal()+ .with(mockall::predicate::eq("win"), mockall::predicate::eq("M-Left"))+ .times(1)+ .returning(|_, _| Ok(()));++ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::Left, crossterm::event::KeyModifiers::ALT),+ &mock_tmux,+ );++ let mut mock_tmux2 = MockTmuxOperations::new();+ mock_tmux2+ .expect_send_keys_literal()+ .with(mockall::predicate::eq("win"), mockall::predicate::eq("M-Right"))+ .times(1)+ .returning(|_, _| Ok(()));++ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::Right, crossterm::event::KeyModifiers::ALT),+ &mock_tmux2,+ );+}++/// Test Alt+b / Alt+f (macOS Option+Left/Right Emacs-style) send M-b / M-f+#[test]+#[cfg(feature = "test-mocks")]+fn test_send_key_to_tmux_alt_b_f() {+ let mut mock_tmux = MockTmuxOperations::new();+ mock_tmux+ .expect_send_keys_literal()+ .with(mockall::predicate::eq("win"), mockall::predicate::eq("M-b"))+ .times(1)+ .returning(|_, _| Ok(()));++ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::Char('b'), crossterm::event::KeyModifiers::ALT),+ &mock_tmux,+ );++ let mut mock_tmux2 = MockTmuxOperations::new();+ mock_tmux2+ .expect_send_keys_literal()+ .with(mockall::predicate::eq("win"), mockall::predicate::eq("M-f"))+ .times(1)+ .returning(|_, _| Ok(()));++ send_key_to_tmux(+ "win",+ crossterm::event::KeyEvent::new(KeyCode::Char('f'), crossterm::event::KeyModifiers::ALT),+ &mock_tmux2,+ );}// =============================================================================@@ -9290,9 +9372,6 @@ fn test_handle_paste_into_shell_popup_calls_paste_text() {*received_c.lock().unwrap() = text.to_string();Ok(())});- mock_tmux- .expect_capture_pane_with_history()- .returning(|_, _| vec![]);let mut app = App::new_for_test(Some(PathBuf::from("/tmp/test-project")),@@ -9325,9 +9404,6 @@ fn test_handle_paste_into_shell_popup_does_not_call_send_keys_literal() {.expect_paste_text().times(1).returning(|_, _| Ok(()));- mock_tmux- .expect_capture_pane_with_history()- .returning(|_, _| vec![]);// send_keys_literal must NOT be called β mockall panics if an unexpected call occursmock_tmux.expect_send_keys_literal().times(0);