aboutsummaryrefslogtreecommitdiffstats
path: root/src/common
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2021-04-06 16:55:32 +0200
committerGitHub <noreply@github.com>2021-04-06 16:55:32 +0200
commite551bec538fcfe709239fcbc6fc2678335729b8c (patch)
tree0c9a591ee9a67f94222fdc14c501c8f825832cf3 /src/common
parentfix(terminal): support bright colors (#256) (diff)
downloadsl0ppij-e551bec538fcfe709239fcbc6fc2678335729b8c.tar.gz
sl0ppij-e551bec538fcfe709239fcbc6fc2678335729b8c.tar.xz
sl0ppij-e551bec538fcfe709239fcbc6fc2678335729b8c.zip
fix(screen): handle events directed at other tabs (#257)
Diffstat (limited to 'src/common')
-rw-r--r--src/common/mod.rs20
1 files changed, 16 insertions, 4 deletions
diff --git a/src/common/mod.rs b/src/common/mod.rs
index e9b74d58..8180a724 100644
--- a/src/common/mod.rs
+++ b/src/common/mod.rs
@@ -276,10 +276,22 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
screen.send_pty_instructions.update(err_ctx);
match event {
ScreenInstruction::Pty(pid, vte_event) => {
- screen
- .get_active_tab_mut()
- .unwrap()
- .handle_pty_event(pid, vte_event);
+ let active_tab = screen.get_active_tab_mut().unwrap();
+ if active_tab.has_terminal_pid(pid) {
+ // it's most likely that this event is directed at the active tab
+ // look there first
+ active_tab.handle_pty_event(pid, vte_event);
+ } else {
+ // if this event wasn't directed at the active tab, start looking
+ // in other tabs
+ let all_tabs = screen.get_tabs_mut();
+ for tab in all_tabs.values_mut() {
+ if tab.has_terminal_pid(pid) {
+ tab.handle_pty_event(pid, vte_event);
+ break;
+ }
+ }
+ }
}
ScreenInstruction::Render => {
screen.render();