aboutsummaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorKunal Mohan <kunalmohan99@gmail.com>2021-04-04 01:24:46 +0530
committerKunal Mohan <kunalmohan99@gmail.com>2021-05-04 20:48:15 +0530
commit2a648187fc8d4afc9b34d322b4f8394dcd39b6dd (patch)
treee85afef2b8e03d6e86a85f57c9b9a3da75d823e3 /src/client
parentMove screen and plugins to client side. (diff)
downloadsl0ppij-2a648187fc8d4afc9b34d322b4f8394dcd39b6dd.tar.gz
sl0ppij-2a648187fc8d4afc9b34d322b4f8394dcd39b6dd.tar.xz
sl0ppij-2a648187fc8d4afc9b34d322b4f8394dcd39b6dd.zip
Fix after rebase
Diffstat (limited to 'src/client')
-rw-r--r--src/client/mod.rs17
-rw-r--r--src/client/pane_resizer.rs6
-rw-r--r--src/client/tab.rs17
3 files changed, 32 insertions, 8 deletions
diff --git a/src/client/mod.rs b/src/client/mod.rs
index ae298a5e..b6a0231a 100644
--- a/src/client/mod.rs
+++ b/src/client/mod.rs
@@ -69,6 +69,23 @@ pub fn start_client(mut os_input: Box<dyn ClientOsApi>) {
move || input_loop(os_input, command_is_executing, send_client_instructions)
});
+ let _signal_thread = thread::Builder::new()
+ .name("signal_listener".to_string())
+ .spawn({
+ let os_input = os_input.clone();
+ move || {
+ os_input.receive_sigwinch(Box::new({
+ let os_api = os_input.clone();
+ move || {
+ os_api.send_to_server(ServerInstruction::terminal_resize(
+ os_api.get_terminal_size_using_fd(0),
+ ));
+ }
+ }));
+ }
+ })
+ .unwrap();
+
let router_thread = thread::Builder::new()
.name("router".to_string())
.spawn({
diff --git a/src/client/pane_resizer.rs b/src/client/pane_resizer.rs
index f9ec71b8..73678499 100644
--- a/src/client/pane_resizer.rs
+++ b/src/client/pane_resizer.rs
@@ -1,4 +1,4 @@
-use crate::os_input_output::OsApi;
+use crate::os_input_output::ServerOsApi;
use crate::panes::{PaneId, PositionAndSize};
use crate::tab::Pane;
use std::{
@@ -8,7 +8,7 @@ use std::{
pub struct PaneResizer<'a> {
panes: &'a mut BTreeMap<PaneId, Box<dyn Pane>>,
- os_api: &'a mut Box<dyn OsApi>,
+ os_api: &'a mut Box<dyn ServerOsApi>,
}
// TODO: currently there are some functions here duplicated with Tab
@@ -17,7 +17,7 @@ pub struct PaneResizer<'a> {
impl<'a> PaneResizer<'a> {
pub fn new(
panes: &'a mut BTreeMap<PaneId, Box<dyn Pane>>,
- os_api: &'a mut Box<dyn OsApi>,
+ os_api: &'a mut Box<dyn ServerOsApi>,
) -> Self {
PaneResizer { panes, os_api }
}
diff --git a/src/client/tab.rs b/src/client/tab.rs
index 4eabab10..3817a327 100644
--- a/src/client/tab.rs
+++ b/src/client/tab.rs
@@ -2,22 +2,24 @@
//! as well as how they should be resized
use crate::boundaries::colors;
+use crate::client::pane_resizer::PaneResizer;
use crate::common::{input::handler::parse_keys, SenderWithContext};
use crate::layout::Layout;
use crate::os_input_output::ServerOsApi;
use crate::panes::{PaneId, PositionAndSize, TerminalPane};
use crate::pty_bus::{PtyInstruction, VteEvent};
use crate::server::ServerInstruction;
-use crate::utils::shared::pad_to_size;
+use crate::utils::shared::adjust_to_size;
use crate::wasm_vm::PluginInstruction;
use crate::{boundaries::Boundaries, panes::PluginPane};
+use serde::{Deserialize, Serialize};
use std::os::unix::io::RawFd;
use std::sync::mpsc::channel;
use std::{
cmp::Reverse,
collections::{BTreeMap, HashSet},
};
-use zellij_tile::data::{Event, InputMode};
+use zellij_tile::data::{Event, ModeInfo};
const CURSOR_HEIGHT_WIDTH_RATIO: usize = 4; // this is not accurate and kind of a magic number, TODO: look into this
@@ -729,9 +731,14 @@ impl Tab {
);
let hide_cursor = "\u{1b}[?25l";
output.push_str(hide_cursor);
- for (kind, terminal) in self.panes.iter_mut() {
- if !self.panes_to_hide.contains(&terminal.pid()) {
- match self.active_terminal.unwrap() == terminal.pid() {
+ if self.should_clear_display_before_rendering {
+ let clear_display = "\u{1b}[2J";
+ output.push_str(clear_display);
+ self.should_clear_display_before_rendering = false;
+ }
+ for (kind, pane) in self.panes.iter_mut() {
+ if !self.panes_to_hide.contains(&pane.pid()) {
+ match self.active_terminal.unwrap() == pane.pid() {
true => {
pane.set_active_at(Instant::now());
boundaries.add_rect(pane.as_ref(), self.mode_info.mode, Some(self.colors))