aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/screen.rs
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-03-20 16:54:18 +0200
committerdenis <denismaximov98@gmail.com>2021-03-20 16:54:18 +0200
commit021c8608c8d8a0cd43328d9c0bede5259bd14261 (patch)
treee51b4ac728b573c01e71905815097a03ecfda7e0 /src/common/screen.rs
parentwip: active pane color, able to type / not able to type inside a pane distinc... (diff)
downloadsl0ppij-021c8608c8d8a0cd43328d9c0bede5259bd14261.tar.gz
sl0ppij-021c8608c8d8a0cd43328d9c0bede5259bd14261.tar.xz
sl0ppij-021c8608c8d8a0cd43328d9c0bede5259bd14261.zip
wip: not sure about updating the input_mode and tab switches for now
Diffstat (limited to 'src/common/screen.rs')
-rw-r--r--src/common/screen.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/screen.rs b/src/common/screen.rs
index 57bb0e0f..a675ee07 100644
--- a/src/common/screen.rs
+++ b/src/common/screen.rs
@@ -5,7 +5,9 @@ use std::os::unix::io::RawFd;
use std::str;
use std::sync::mpsc::Receiver;
-use super::{AppInstruction, SenderWithContext};
+use wasmer::wasmparser::WasmFuncType;
+
+use super::{AppInstruction, SenderWithContext, input::handler::InputMode};
use crate::os_input_output::OsApi;
use crate::panes::PositionAndSize;
use crate::pty_bus::{PtyInstruction, VteEvent};
@@ -48,6 +50,7 @@ pub enum ScreenInstruction {
CloseTab,
GoToTab(u32),
UpdateTabName(Vec<u8>),
+ ChangeInputMode(InputMode)
}
/// A [`Screen`] holds multiple [`Tab`]s, each one holding multiple [`panes`](crate::client::panes).
@@ -72,6 +75,7 @@ pub struct Screen {
/// The [`OsApi`] this [`Screen`] uses.
os_api: Box<dyn OsApi>,
tabname_buf: String,
+ input_mode: InputMode
}
impl Screen {
@@ -84,6 +88,7 @@ impl Screen {
full_screen_ws: &PositionAndSize,
os_api: Box<dyn OsApi>,
max_panes: Option<usize>,
+ input_mode: InputMode
) -> Self {
Screen {
receiver: receive_screen_instructions,
@@ -96,6 +101,7 @@ impl Screen {
tabs: BTreeMap::new(),
os_api,
tabname_buf: String::new(),
+ input_mode
}
}
@@ -115,6 +121,7 @@ impl Screen {
self.send_app_instructions.clone(),
self.max_panes,
Some(PaneId::Terminal(pane_id)),
+ self.input_mode
);
self.active_tab_index = Some(tab_index);
self.tabs.insert(tab_index, tab);
@@ -259,6 +266,7 @@ impl Screen {
self.send_app_instructions.clone(),
self.max_panes,
None,
+ self.input_mode
);
tab.apply_layout(layout, new_pids);
self.active_tab_index = Some(tab_index);
@@ -274,6 +282,7 @@ impl Screen {
position: tab.position,
name: tab.name.clone(),
active: active_tab_index == tab.index,
+ input_mode: self.input_mode
});
}
self.send_plugin_instructions
@@ -303,4 +312,9 @@ impl Screen {
}
}
}
+ pub fn change_input_mode(&mut self, input_mode: InputMode) {
+ self.input_mode = input_mode;
+ self.get_active_tab_mut().unwrap().input_mode = self.input_mode;
+ self.render();
+ }
}