summaryrefslogtreecommitdiffstats
path: root/zellij-client
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-08-30 09:58:48 +0200
committerGitHub <noreply@github.com>2023-08-30 09:58:48 +0200
commit2081a2e64fcd3c93489d4b4c22478faf784ef73f (patch)
tree201615241bc9be0b4f2cab1f460ef3c866ff4240 /zellij-client
parent90875b0c00498fef00fac673086bd30145b64ccd (diff)
fix(reconnect): do not clear terminal state when entering alternate screen (#2750)
* debug * refactor(reconnect): articular reconnection logic
Diffstat (limited to 'zellij-client')
-rw-r--r--zellij-client/src/lib.rs25
1 files changed, 16 insertions, 9 deletions
diff --git a/zellij-client/src/lib.rs b/zellij-client/src/lib.rs
index 8dbae4f0a..bbfc6a15f 100644
--- a/zellij-client/src/lib.rs
+++ b/zellij-client/src/lib.rs
@@ -147,6 +147,7 @@ pub fn start_client(
layout: Option<Layout>,
tab_position_to_focus: Option<usize>,
pane_id_to_focus: Option<(u32, bool)>, // (pane_id, is_plugin)
+ is_a_reconnect: bool,
) -> Option<ConnectToSession> {
info!("Starting Zellij client!");
@@ -156,14 +157,19 @@ pub fn start_client(
let bracketed_paste = "\u{1b}[?2004h";
os_input.unset_raw_mode(0).unwrap();
- let _ = os_input
- .get_stdout_writer()
- .write(take_snapshot.as_bytes())
- .unwrap();
- let _ = os_input
- .get_stdout_writer()
- .write(clear_client_terminal_attributes.as_bytes())
- .unwrap();
+ if !is_a_reconnect {
+ // we don't do this for a reconnect because our controlling terminal already has the
+ // attributes we want from it, and some terminals don't treat these atomically (looking at
+ // your Windows Terminal...)
+ let _ = os_input
+ .get_stdout_writer()
+ .write(take_snapshot.as_bytes())
+ .unwrap();
+ let _ = os_input
+ .get_stdout_writer()
+ .write(clear_client_terminal_attributes.as_bytes())
+ .unwrap();
+ }
envs::set_zellij("0".to_string());
config.env.set_vars();
@@ -172,6 +178,7 @@ pub fn start_client(
.unwrap_or_else(|| os_input.load_palette());
let full_screen_ws = os_input.get_terminal_size_using_fd(0);
+ log::info!("full_screen_ws: {:?}", full_screen_ws);
let client_attributes = ClientAttributes {
size: full_screen_ws,
style: Style {
@@ -375,7 +382,7 @@ pub fn start_client(
let mut stdout = os_input.get_stdout_writer();
stdout
- .write_all("\u{1b}[1mLoading Zellij\u{1b}[m\n\r".as_bytes())
+ .write_all("\u{1b}[1m\u{1b}[HLoading Zellij\u{1b}[m\n\r".as_bytes())
.expect("cannot write to stdout");
stdout.flush().expect("could not flush");