diff options
| author | Can Celik <ogulcancelik@gmail.com> | 2026-08-01 04:27:50 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-08-01 04:27:50 +0300 |
| commit | b76adc155d979705a353fd6dc87c702f9dfc6c22 (patch) | |
| tree | f613254e0cfbfd2b4450a6a5f3ee7c0ba8136976 /src/app/input/mod.rs | |
| parent | 8d190eddda2c74afa3dc043f8ec8020ffd7b5a94 (diff) | |
fix(input): preserve native key lifecycle across routing (#2142)
refs #2077
Co-authored-by: Jonathan Liebig <jonathan.liebig@gmail.com>
Diffstat (limited to 'src/app/input/mod.rs')
| -rw-r--r-- | src/app/input/mod.rs | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/app/input/mod.rs b/src/app/input/mod.rs index 40bc82fb..f22c7994 100644 --- a/src/app/input/mod.rs +++ b/src/app/input/mod.rs @@ -38,6 +38,7 @@ fn modified_url_click_modifier_matches_terminal_mouse_reporting() { mod clipboard; mod copy_mode; +mod lease; mod modal; mod mouse; mod navigate; @@ -48,6 +49,7 @@ mod sidebar; mod terminal; pub(crate) use self::{ + lease::{ConsumedInputLease, ForwardedInputLease, InputLeaseKey, InputLeaseTable, RepeatPlan}, modal::{ handle_global_menu_key, handle_keybind_help_key, handle_navigator_key, insert_keybind_help_query_text, insert_navigator_search_text, insert_rename_input_text, @@ -121,6 +123,66 @@ impl App { None } + pub(crate) fn handle_text_commit_headless(&mut self, text: &str) { + if text.is_empty() { + return; + } + if self.state.popup_pane.is_some() { + if let Some(runtime) = self.popup_runtime() { + let _ = runtime.try_send_bytes(Bytes::copy_from_slice(text.as_bytes())); + } else { + self.close_popup_pane(); + } + return; + } + if self.state.mode != Mode::Terminal { + self.paste_into_active_text_input(text); + return; + } + + self.state.clear_selection(); + self.selection_autoscroll_deadline = None; + self.state.update_dismissed = true; + if let Some(ws_idx) = self.state.active { + if let Some(runtime) = self + .state + .focused_runtime_in_workspace(&self.terminal_runtimes, ws_idx) + { + let _ = runtime.try_send_bytes(Bytes::copy_from_slice(text.as_bytes())); + } + } + } + + pub(super) async fn handle_text_commit(&mut self, text: String) { + if text.is_empty() { + return; + } + if self.state.popup_pane.is_some() { + if let Some(runtime) = self.popup_runtime() { + let _ = runtime.send_bytes(Bytes::from(text)).await; + } else { + self.close_popup_pane(); + } + return; + } + if self.state.mode != Mode::Terminal { + self.paste_into_active_text_input(&text); + return; + } + + self.state.clear_selection(); + self.selection_autoscroll_deadline = None; + self.state.update_dismissed = true; + if let Some(ws_idx) = self.state.active { + if let Some(runtime) = self + .state + .focused_runtime_in_workspace(&self.terminal_runtimes, ws_idx) + { + let _ = runtime.send_bytes(Bytes::from(text)).await; + } + } + } + pub(super) async fn handle_paste(&mut self, text: String) { if self.state.popup_pane.is_some() { if let Some(runtime) = self.popup_runtime() { |
