aboutsummaryrefslogtreecommitdiffstats
path: root/src/client/tab.rs
diff options
context:
space:
mode:
authordenis <denismaximov98@gmail.com>2021-03-19 16:11:45 +0200
committerdenis <denismaximov98@gmail.com>2021-03-19 16:11:45 +0200
commit59d2da54ca1f504af4271d96ba069b2d7a75ac2e (patch)
tree32a966b733d9fd8dac19d5e51bb8340f94808c41 /src/client/tab.rs
parentwip: the borders are colored correctly now, need to change the color accordin... (diff)
downloadsl0ppij-59d2da54ca1f504af4271d96ba069b2d7a75ac2e.tar.gz
sl0ppij-59d2da54ca1f504af4271d96ba069b2d7a75ac2e.tar.xz
sl0ppij-59d2da54ca1f504af4271d96ba069b2d7a75ac2e.zip
wip: active pane color, able to type / not able to type inside a pane distinction
Diffstat (limited to 'src/client/tab.rs')
-rw-r--r--src/client/tab.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/client/tab.rs b/src/client/tab.rs
index c8f9209d..ecb94eb2 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -1,7 +1,8 @@
//! `Tab`s holds multiple panes. It tracks their coordinates (x/y) and size,
//! as well as how they should be resized
-use crate::common::{AppInstruction, SenderWithContext};
+use crate::common::input::handler::get_help;
+use crate::common::{input::handler::InputMode, AppInstruction, AppState, SenderWithContext};
use crate::layout::Layout;
use crate::panes::{PaneId, PositionAndSize, TerminalPane};
use crate::pty_bus::{PtyInstruction, VteEvent};
@@ -21,7 +22,13 @@ 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;
@@ -631,6 +638,7 @@ 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
@@ -643,14 +651,15 @@ impl Tab {
self.full_screen_ws.rows as u16,
);
let hide_cursor = "\u{1b}[?25l";
+ let input_mode = 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),
- false => boundaries.add_rect(terminal.as_ref(), false),
+ true => boundaries.add_rect(terminal.as_ref(), true, input_mode),
+ false => boundaries.add_rect(terminal.as_ref(), false, input_mode),
}
if let Some(vte_output) = terminal.render() {
let vte_output = if let PaneId::Terminal(_) = kind {