aboutsummaryrefslogtreecommitdiffstats
path: root/src/tab.rs
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2021-01-10 23:02:41 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2021-01-10 23:02:41 +0000
commit7e308515e5af960857504fc583b5900b3dc4edd4 (patch)
tree3c8728db22ca457fc430dd73ab05e387b1f378d5 /src/tab.rs
parentAdd support for layouts with parts of a fixed or unspecified size (diff)
downloadsl0ppij-7e308515e5af960857504fc583b5900b3dc4edd4.tar.gz
sl0ppij-7e308515e5af960857504fc583b5900b3dc4edd4.tar.xz
sl0ppij-7e308515e5af960857504fc583b5900b3dc4edd4.zip
Add a plugin callback for global keypresses
Diffstat (limited to 'src/tab.rs')
-rw-r--r--src/tab.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/tab.rs b/src/tab.rs
index 7a56508c..9990026a 100644
--- a/src/tab.rs
+++ b/src/tab.rs
@@ -473,23 +473,23 @@ impl Tab {
}
}
pub fn write_to_active_terminal(&mut self, input_bytes: Vec<u8>) {
- 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();
- }
- _ => {}
+ let pid = self.get_active_pane_id();
+
+ if let Some(pid) = pid {
+ self.send_plugin_instructions
+ .send(PluginInstruction::Input(pid, input_bytes.clone()))
+ .unwrap();
+ }
+
+ if let Some(PaneId::Terminal(active_terminal_id)) = pid {
+ 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");
}
}
pub fn get_active_terminal_cursor_position(&self) -> Option<(usize, usize)> {