aboutsummaryrefslogtreecommitdiffstats
path: root/src/client
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/client
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/client')
-rw-r--r--src/client/boundaries.rs1
-rw-r--r--src/client/tab.rs25
2 files changed, 15 insertions, 11 deletions
diff --git a/src/client/boundaries.rs b/src/client/boundaries.rs
index 1a8174e3..a5f5965b 100644
--- a/src/client/boundaries.rs
+++ b/src/client/boundaries.rs
@@ -1,4 +1,3 @@
-use crate::common::utils::logging::debug_log_to_file;
use crate::{common::input::handler::InputMode, tab::Pane};
use ansi_term::Colour::{self, Fixed};
use std::collections::HashMap;
diff --git a/src/client/tab.rs b/src/client/tab.rs
index ecb94eb2..dad75e30 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -22,13 +22,7 @@ const MIN_TERMINAL_HEIGHT: usize = 2;
const MIN_TERMINAL_WIDTH: usize = 4;
type BorderAndPaneIds = (usize, Vec<PaneId>);
-fn get_state(app_tx: &SenderWithContext<AppInstruction>) -> InputMode {
- let (state_tx, state_rx) = channel();
- drop(app_tx.send(AppInstruction::GetState(state_tx)));
- let state = state_rx.recv().unwrap();
- state.input_mode
-}
fn split_vertically_with_gap(rect: &PositionAndSize) -> (PositionAndSize, PositionAndSize) {
let width_of_each_half = (rect.columns - 1) / 2;
let mut first_rect = *rect;
@@ -72,6 +66,7 @@ pub struct Tab {
pub send_plugin_instructions: SenderWithContext<PluginInstruction>,
pub send_app_instructions: SenderWithContext<AppInstruction>,
expansion_boundary: Option<PositionAndSize>,
+ pub input_mode: InputMode
}
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
@@ -80,6 +75,7 @@ pub struct TabData {
pub position: usize,
pub name: String,
pub active: bool,
+ pub input_mode: InputMode
}
// FIXME: Use a struct that has a pane_type enum, to reduce all of the duplication
@@ -199,6 +195,7 @@ impl Tab {
send_app_instructions: SenderWithContext<AppInstruction>,
max_panes: Option<usize>,
pane_id: Option<PaneId>,
+ input_mode: InputMode
) -> Self {
let panes = if let Some(PaneId::Terminal(pid)) = pane_id {
let new_terminal = TerminalPane::new(pid, *full_screen_ws);
@@ -228,6 +225,7 @@ impl Tab {
send_pty_instructions,
send_plugin_instructions,
expansion_boundary: None,
+ input_mode
}
}
@@ -638,7 +636,6 @@ impl Tab {
pub fn toggle_fullscreen_is_active(&mut self) {
self.fullscreen_is_active = !self.fullscreen_is_active;
}
-
pub fn render(&mut self) {
if self.active_terminal.is_none() {
// we might not have an active terminal if we closed the last pane
@@ -651,15 +648,23 @@ impl Tab {
self.full_screen_ws.rows as u16,
);
let hide_cursor = "\u{1b}[?25l";
- let input_mode = get_state(&self.send_app_instructions);
+ //let input_mode = self.get_state(&self.send_app_instructions);
stdout
.write_all(&hide_cursor.as_bytes())
.expect("cannot write to stdout");
for (kind, terminal) in self.panes.iter_mut() {
if !self.panes_to_hide.contains(&terminal.pid()) {
match self.active_terminal.unwrap() == terminal.pid() {
- true => boundaries.add_rect(terminal.as_ref(), true, input_mode),
- false => boundaries.add_rect(terminal.as_ref(), false, input_mode),
+ true => boundaries.add_rect(
+ terminal.as_ref(),
+ true,
+ self.input_mode
+ ),
+ false => boundaries.add_rect(
+ terminal.as_ref(),
+ false,
+ self.input_mode
+ ),
}
if let Some(vte_output) = terminal.render() {
let vte_output = if let PaneId::Terminal(_) = kind {