aboutsummaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-01-07 09:39:16 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2021-01-07 09:39:16 +0000
commit01eaedcd3746e9de30fe867340667c65d8eb2733 (patch)
treed4a2ce89265d1a38ac8a4041821058336d43d1a6 /src/tab.rs
parentMerge branch 'main' into wasm-launchable (diff)
downloadsl0ppij-01eaedcd3746e9de30fe867340667c65d8eb2733.tar.gz
sl0ppij-01eaedcd3746e9de30fe867340667c65d8eb2733.tar.xz
sl0ppij-01eaedcd3746e9de30fe867340667c65d8eb2733.zip
Parse bytes into keys with Termion
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs26
1 files changed, 17 insertions, 9 deletions
diff --git a/src/tab.rs b/src/tab.rs
index ea709c7c..5eafb9f8 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -472,15 +472,23 @@ impl Tab {
}
}
pub fn write_to_active_terminal(&mut self, input_bytes: Vec<u8>) {
- if let Some(active_terminal_id) = &self.get_active_terminal_id() {
- let active_terminal = self.get_active_pane().unwrap();
- let mut adjusted_input = active_terminal.adjust_input_to_terminal(input_bytes);
- self.os_api
- .write_to_tty_stdin(*active_terminal_id, &mut adjusted_input)
- .expect("failed to write to terminal");
- self.os_api
- .tcdrain(*active_terminal_id)
- .expect("failed to drain terminal");
+ match self.get_active_pane_id() {
+ Some(PaneId::Terminal(active_terminal_id)) => {
+ let active_terminal = self.get_active_pane().unwrap();
+ let mut adjusted_input = active_terminal.adjust_input_to_terminal(input_bytes);
+ self.os_api
+ .write_to_tty_stdin(active_terminal_id, &mut adjusted_input)
+ .expect("failed to write to terminal");
+ self.os_api
+ .tcdrain(active_terminal_id)
+ .expect("failed to drain terminal");
+ }
+ Some(PaneId::Plugin(pid)) => {
+ self.send_plugin_instructions
+ .send(PluginInstruction::Input(pid, input_bytes))
+ .unwrap();
+ }
+ _ => {}
}
}
pub fn get_active_terminal_cursor_position(&self) -> Option<(usize, usize)> {