diff options
author | Thomas Linford <linford.t@gmail.com> | 2023-04-18 16:18:47 +0200 |
---|---|---|
committer | Thomas Linford <linford.t@gmail.com> | 2023-04-18 16:18:47 +0200 |
commit | 86fa0f3ccb2391c736d10c50d5cb6f94dc962b6c (patch) | |
tree | 4ba0db31f394296fe9d67e88db2f94e994ae5547 | |
parent | 3b82e49d353005468ccd1e8d2b95300e4f189c5d (diff) | |
parent | c7bd2ce9222d328369216ba287c57752910e0e88 (diff) |
Merge remote-tracking branch 'upstream/main' into fix/reap-dropped-linksfix/reap-dropped-links
-rw-r--r-- | CHANGELOG.md | 6 | ||||
-rw-r--r-- | Cargo.lock | 12 | ||||
-rw-r--r-- | Cargo.toml | 8 | ||||
-rw-r--r-- | assets/logo.png | bin | 218189 -> 287796 bytes | |||
-rw-r--r-- | default-plugins/compact-bar/src/line.rs | 6 | ||||
-rw-r--r-- | default-plugins/compact-bar/src/main.rs | 1 | ||||
-rw-r--r-- | zellij-client/Cargo.toml | 4 | ||||
-rw-r--r-- | zellij-server/Cargo.toml | 4 | ||||
-rw-r--r-- | zellij-server/src/lib.rs | 45 | ||||
-rw-r--r-- | zellij-server/src/screen.rs | 2 | ||||
-rw-r--r-- | zellij-server/src/tab/mod.rs | 34 | ||||
-rw-r--r-- | zellij-server/src/tab/unit/tab_integration_tests.rs | 4 | ||||
-rw-r--r-- | zellij-server/src/tab/unit/tab_tests.rs | 2 | ||||
-rw-r--r-- | zellij-tile-utils/Cargo.toml | 2 | ||||
-rw-r--r-- | zellij-tile/Cargo.toml | 4 | ||||
-rw-r--r-- | zellij-utils/Cargo.toml | 2 | ||||
-rwxr-xr-x | zellij-utils/assets/plugins/compact-bar.wasm | bin | 489887 -> 488843 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/status-bar.wasm | bin | 622998 -> 621120 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/strider.wasm | bin | 504360 -> 502993 bytes | |||
-rwxr-xr-x | zellij-utils/assets/plugins/tab-bar.wasm | bin | 459061 -> 459471 bytes |
20 files changed, 76 insertions, 60 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a6d9e546..2ef8634d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) ## [Unreleased] +* fix(plugin): respect hide session option on compact-bar (https://github.com/zellij-org/zellij/pull/2368) + +## [0.36.0] - 2023-04-13 * fix: when moving pane focus off screen edge to the next tab, the pane on the screen edge is now focused (https://github.com/zellij-org/zellij/pull/2293) * fix: adding panes to lone stack (https://github.com/zellij-org/zellij/pull/2298) * fix: closing a stacked pane now properly moves to the previous swap layout if appropriate (https://github.com/zellij-org/zellij/pull/2312) @@ -18,6 +21,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) * fix: tab focus race condition when applying layout (https://github.com/zellij-org/zellij/pull/2340) * feat: allow specifying an "expanded" pane in a stack when defining layouts (https://github.com/zellij-org/zellij/pull/2343) * fix: stacked pane focus glitches in layout (https://github.com/zellij-org/zellij/pull/2344) +* fix: strider now no longer opens one pane per client when editing files (https://github.com/zellij-org/zellij/pull/2346) +* fix: set sticky bit on socket files to avoid automatic cleanup (https://github.com/zellij-org/zellij/pull/2141) +* fix: memory leak when attaching/detaching from sessions (https://github.com/zellij-org/zellij/pull/2328) ## [0.35.2] - 2023-03-10 * fix: get "zellij attach --create" working again (https://github.com/zellij-org/zellij/pull/2247) diff --git a/Cargo.lock b/Cargo.lock index fb040fad2..1c580f328 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3948,7 +3948,7 @@ dependencies = [ [[package]] name = "zellij" -version = "0.36.0" +version = "0.37.0" dependencies = [ "anyhow", "dialoguer", @@ -3967,7 +3967,7 @@ dependencies = [ [[package]] name = "zellij-client" -version = "0.36.0" +version = "0.37.0" dependencies = [ "insta", "log", @@ -3981,7 +3981,7 @@ dependencies = [ [[package]] name = "zellij-server" -version = "0.36.0" +version = "0.37.0" dependencies = [ "ansi_term", "arrayvec 0.7.2", @@ -4011,7 +4011,7 @@ dependencies = [ [[package]] name = "zellij-tile" -version = "0.36.0" +version = "0.37.0" dependencies = [ "clap", "serde", @@ -4023,14 +4023,14 @@ dependencies = [ [[package]] name = "zellij-tile-utils" -version = "0.36.0" +version = "0.37.0" dependencies = [ "ansi_term", ] [[package]] name = "zellij-utils" -version = "0.36.0" +version = "0.37.0" dependencies = [ "anyhow", "async-std", diff --git a/Cargo.toml b/Cargo.toml index bb1bfbce8..56c855f09 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij" -version = "0.36.0" +version = "0.37.0" authors = ["Aram Drevekenin <aram@poor.dev>"] edition = "2021" description = "A terminal workspace with batteries included" @@ -17,9 +17,9 @@ anyhow = "1.0" thiserror = "1.0.30" names = { version = "0.13.0", default-features = false } miette = { version = "3.3.0", features = ["fancy"] } -zellij-client = { path = "zellij-client/", version = "0.36.0" } -zellij-server = { path = "zellij-server/", version = "0.36.0" } -zellij-utils = { path = "zellij-utils/", version = "0.36.0" } +zellij-client = { path = "zellij-client/", version = "0.37.0" } +zellij-server = { path = "zellij-server/", version = "0.37.0" } +zellij-utils = { path = "zellij-utils/", version = "0.37.0" } log = "0.4.17" dialoguer = "0.10.1" suggest = "0.4" diff --git a/assets/logo.png b/assets/logo.png Binary files differindex a36dce061..7d87123ce 100644 --- a/assets/logo.png +++ b/assets/logo.png diff --git a/default-plugins/compact-bar/src/line.rs b/default-plugins/compact-bar/src/line.rs index 6bcbab18a..f1f10eab0 100644 --- a/default-plugins/compact-bar/src/line.rs +++ b/default-plugins/compact-bar/src/line.rs @@ -255,6 +255,7 @@ pub fn tab_line( cols: usize, palette: Palette, capabilities: PluginCapabilities, + hide_session_name: bool, mode: InputMode, active_swap_layout_name: &Option<String>, is_swap_layout_dirty: bool, @@ -266,7 +267,10 @@ pub fn tab_line( } else { tabs_before_active.pop().unwrap() }; - let mut prefix = tab_line_prefix(session_name, mode, palette, cols); + let mut prefix = match hide_session_name { + true => tab_line_prefix(None, mode, palette, cols), + false => tab_line_prefix(session_name, mode, palette, cols), + }; let prefix_len = get_current_title_len(&prefix); // if active tab alone won't fit in cols, don't draw any tabs diff --git a/default-plugins/compact-bar/src/main.rs b/default-plugins/compact-bar/src/main.rs index 71652f0f1..451c3cd8f 100644 --- a/default-plugins/compact-bar/src/main.rs +++ b/default-plugins/compact-bar/src/main.rs @@ -124,6 +124,7 @@ impl ZellijPlugin for State { cols.saturating_sub(1), self.mode_info.style.colors, self.mode_info.capabilities, + self.mode_info.style.hide_session_name, self.mode_info.mode, &active_swap_layout_name, is_swap_layout_dirty, diff --git a/zellij-client/Cargo.toml b/zellij-client/Cargo.toml index 3649d1999..8b6c87cbb 100644 --- a/zellij-client/Cargo.toml +++ b/zellij-client/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij-client" -version = "0.36.0" +version = "0.37.0" authors = ["Kunal Mohan <kunalmohan99@gmail.com>"] edition = "2021" description = "The client-side library for Zellij" @@ -14,7 +14,7 @@ serde = { version = "1.0", features = ["derive"] } url = { version = "2.2.2", features = ["serde"] } serde_yaml = "0.8" serde_json = "1.0" -zellij-utils = { path = "../zellij-utils/", version = "0.36.0" } +zellij-utils = { path = "../zellij-utils/", version = "0.37.0" } log = "0.4.17" [dev-dependencies] diff --git a/zellij-server/Cargo.toml b/zellij-server/Cargo.toml index c77769280..0fa9fe1e3 100644 --- a/zellij-server/Cargo.toml +++ b/zellij-server/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij-server" -version = "0.36.0" +version = "0.37.0" authors = ["Kunal Mohan <kunalmohan99@gmail.com>"] edition = "2021" description = "The server-side library for Zellij" @@ -21,7 +21,7 @@ url = "2.2.2" wasmer = "2.3.0" wasmer-wasi = "2.3.0" cassowary = "0.3.0" -zellij-utils = { path = "../zellij-utils/", version = "0.36.0" } +zellij-utils = { path = "../zellij-utils/", version = "0.37.0" } log = "0.4.17" typetag = "0.1.7" chrono = "0.4.19" diff --git a/zellij-server/src/lib.rs b/zellij-server/src/lib.rs index 34c807f16..45ea85940 100644 --- a/zellij-server/src/lib.rs +++ b/zellij-server/src/lib.rs @@ -20,7 +20,7 @@ use pty_writer::{pty_writer_main, PtyWriteInstruction}; use std::collections::{HashMap, HashSet}; use std::{ path::PathBuf, - sync::{Arc, Mutex, RwLock}, + sync::{Arc, RwLock}, thread, }; use zellij_utils::envs; @@ -260,8 +260,6 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { }) }); - let thread_handles = Arc::new(Mutex::new(Vec::new())); - let _ = thread::Builder::new() .name("server_listener".to_string()) .spawn({ @@ -274,11 +272,13 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let session_state = session_state.clone(); let to_server = to_server.clone(); let socket_path = socket_path.clone(); - let thread_handles = thread_handles.clone(); move || { drop(std::fs::remove_file(&socket_path)); let listener = LocalSocketListener::bind(&*socket_path).unwrap(); - set_permissions(&socket_path, 0o700).unwrap(); + // set the sticky bit to avoid the socket file being potentially cleaned up + // https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html states that for XDG_RUNTIME_DIR: + // "To ensure that your files are not removed, they should have their access time timestamp modified at least once every 6 hours of monotonic time or the 'sticky' bit should be set on the file. " + set_permissions(&socket_path, 0o1700).unwrap(); for stream in listener.incoming() { match stream { Ok(stream) => { @@ -288,22 +288,20 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { let session_data = session_data.clone(); let session_state = session_state.clone(); let to_server = to_server.clone(); - thread_handles.lock().unwrap().push( - thread::Builder::new() - .name("server_router".to_string()) - .spawn(move || { - route_thread_main( - session_data, - session_state, - os_input, - to_server, - receiver, - client_id, - ) - .fatal() - }) - .unwrap(), - ); + thread::Builder::new() + .name("server_router".to_string()) + .spawn(move || { + route_thread_main( + session_data, + session_state, + os_input, + to_server, + receiver, + client_id, + ) + .fatal() + }) + .unwrap(); }, Err(err) => { panic!("err {:?}", err); @@ -639,11 +637,6 @@ pub fn start_server(mut os_input: Box<dyn ServerOsApi>, socket_path: PathBuf) { // Drop cached session data before exit. *session_data.write().unwrap() = None; - thread_handles - .lock() - .unwrap() - .drain(..) - .for_each(|h| drop(h.join())); drop(std::fs::remove_file(&socket_path)); } diff --git a/zellij-server/src/screen.rs b/zellij-server/src/screen.rs index 380b124be..ecd1c7521 100644 --- a/zellij-server/src/screen.rs +++ b/zellij-server/src/screen.rs @@ -1664,7 +1664,7 @@ pub(crate) fn screen_thread_main( client_id, |tab: &mut Tab, client_id: ClientId| { let write_result = match tab.is_sync_panes_active() { - true => tab.write_to_terminals_on_current_tab(bytes), + true => tab.write_to_terminals_on_current_tab(bytes, client_id), false => tab.write_to_active_terminal(bytes, client_id), }; if let Ok(true) = write_result { diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs index eab71da9c..d61eb1a4c 100644 --- a/zellij-server/src/tab/mod.rs +++ b/zellij-server/src/tab/mod.rs @@ -1550,7 +1550,7 @@ impl Tab { let messages_to_pty = terminal_output.drain_messages_to_pty(); let clipboard_update = terminal_output.drain_clipboard_update(); for message in messages_to_pty { - self.write_to_pane_id(message, PaneId::Terminal(pid)) + self.write_to_pane_id(message, PaneId::Terminal(pid), None) .with_context(err_context)?; } if let Some(string) = clipboard_update { @@ -1561,14 +1561,18 @@ impl Tab { Ok(()) } - pub fn write_to_terminals_on_current_tab(&mut self, input_bytes: Vec<u8>) -> Result<bool> { + pub fn write_to_terminals_on_current_tab( + &mut self, + input_bytes: Vec<u8>, + client_id: ClientId, + ) -> Result<bool> { // returns true if a UI update should be triggered (eg. when closing a command pane with // ctrl-c) let mut should_trigger_ui_change = false; let pane_ids = self.get_static_and_floating_pane_ids(); for pane_id in pane_ids { let ui_change_triggered = self - .write_to_pane_id(input_bytes.clone(), pane_id) + .write_to_pane_id(input_bytes.clone(), pane_id, Some(client_id)) .context("failed to write to terminals on current tab")?; if ui_change_triggered { should_trigger_ui_change = true; @@ -1607,7 +1611,7 @@ impl Tab { .with_context(err_context)? }; // Can't use 'err_context' here since it borrows 'input_bytes' - self.write_to_pane_id(input_bytes, pane_id) + self.write_to_pane_id(input_bytes, pane_id, Some(client_id)) .with_context(|| format!("failed to write to active terminal for client {client_id}")) } @@ -1615,6 +1619,7 @@ impl Tab { &mut self, input_bytes: Vec<u8>, position: &Position, + client_id: ClientId, ) -> Result<()> { let err_context = || format!("failed to write to terminal at position {position:?}"); @@ -1624,7 +1629,7 @@ impl Tab { .get_pane_id_at(position, false) .with_context(err_context)?; if let Some(pane_id) = pane_id { - self.write_to_pane_id(input_bytes, pane_id) + self.write_to_pane_id(input_bytes, pane_id, Some(client_id)) .with_context(err_context)?; return Ok(()); } @@ -1634,14 +1639,19 @@ impl Tab { .get_pane_id_at(position, false) .with_context(err_context)?; if let Some(pane_id) = pane_id { - self.write_to_pane_id(input_bytes, pane_id) + self.write_to_pane_id(input_bytes, pane_id, Some(client_id)) .with_context(err_context)?; return Ok(()); } Ok(()) } - pub fn write_to_pane_id(&mut self, input_bytes: Vec<u8>, pane_id: PaneId) -> Result<bool> { + pub fn write_to_pane_id( + &mut self, + input_bytes: Vec<u8>, + pane_id: PaneId, + client_id: Option<ClientId>, + ) -> Result<bool> { // returns true if we need to update the UI (eg. when a command pane is closed with ctrl-c) let err_context = || format!("failed to write to pane with id {pane_id:?}"); @@ -1683,7 +1693,7 @@ impl Tab { PaneId::Plugin(pid) => { let mut plugin_updates = vec![]; for key in parse_keys(&input_bytes) { - plugin_updates.push((Some(pid), None, Event::Key(key))); + plugin_updates.push((Some(pid), client_id, Event::Key(key))); } self.senders .send_to_plugin(PluginInstruction::Update(plugin_updates)) @@ -2592,13 +2602,13 @@ impl Tab { if let Some(pane) = self.get_pane_at(point, false).with_context(err_context)? { let relative_position = pane.relative_position(point); if let Some(mouse_event) = pane.mouse_scroll_up(&relative_position) { - self.write_to_terminal_at(mouse_event.into_bytes(), point) + self.write_to_terminal_at(mouse_event.into_bytes(), point, client_id) .with_context(err_context)?; } else if pane.is_alternate_mode_active() { // faux scrolling, send UP n times // do n separate writes to make sure the sequence gets adjusted for cursor keys mode for _ in 0..lines { - self.write_to_terminal_at("\u{1b}[A".as_bytes().to_owned(), point) + self.write_to_terminal_at("\u{1b}[A".as_bytes().to_owned(), point, client_id) .with_context(err_context)?; } } else { @@ -2623,13 +2633,13 @@ impl Tab { if let Some(pane) = self.get_pane_at(point, false).with_context(err_context)? { let relative_position = pane.relative_position(point); if let Some(mouse_event) = pane.mouse_scroll_down(&relative_position) { - self.write_to_terminal_at(mouse_event.into_bytes(), point) + self.write_to_terminal_at(mouse_event.into_bytes(), point, client_id) .with_context(err_context)?; } else if pane.is_alternate_mode_active() { // faux scrolling, send DOWN n times // do n separate writes to make sure the sequence gets adjusted for cursor keys mode for _ in 0..lines { - self.write_to_terminal_at("\u{1b}[B".as_bytes().to_owned(), point) + self.write_to_terminal_at("\u{1b}[B".as_bytes().to_owned(), point, client_id) .with_context(err_context)?; } } else { diff --git a/zellij-server/src/tab/unit/tab_integration_tests.rs b/zellij-server/src/tab/unit/tab_integration_tests.rs index 24fa1b2f1..48d841a5d 100644 --- a/zellij-server/src/tab/unit/tab_integration_tests.rs +++ b/zellij-server/src/tab/unit/tab_integration_tests.rs @@ -2,7 +2,7 @@ use super::{Output, Tab}; use crate::panes::sixel::SixelImageStore; use crate::screen::CopyOptions; use crate::Arc; -use crate::Mutex; + use crate::{ os_input_output::{AsyncReader, Pid, ServerOsApi}, panes::PaneId, @@ -11,6 +11,8 @@ use crate::{ ClientId, }; use std::path::PathBuf; +use std::sync::Mutex; + use zellij_utils::channels::Receiver; use zellij_utils::data::Direction; use zellij_utils::data::Resize; diff --git a/zellij-server/src/tab/unit/tab_tests.rs b/zellij-server/src/tab/unit/tab_tests.rs index cb3d8f787..bcf02202c 100644 --- a/zellij-server/src/tab/unit/tab_tests.rs +++ b/zellij-server/src/tab/unit/tab_tests.rs @@ -330,7 +330,7 @@ fn write_to_suppressed_pane() { // Make sure it's suppressed now tab.suppressed_panes.get(&PaneId::Terminal(2)).unwrap(); // Write content to it - tab.write_to_pane_id(vec![34, 127, 31, 82, 17, 182], PaneId::Terminal(2)) + tab.write_to_pane_id(vec![34, 127, 31, 82, 17, 182], PaneId::Terminal(2), None) .unwrap(); } diff --git a/zellij-tile-utils/Cargo.toml b/zellij-tile-utils/Cargo.toml index 928f1f08d..2afeb9736 100644 --- a/zellij-tile-utils/Cargo.toml +++ b/zellij-tile-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij-tile-utils" -version = "0.36.0" +version = "0.37.0" authors = ["denis <denismaximov98@gmail.com>"] edition = "2021" description = "A utility library for Zellij plugins" diff --git a/zellij-tile/Cargo.toml b/zellij-tile/Cargo.toml index 41332d317..4e6d4a09e 100644 --- a/zellij-tile/Cargo.toml +++ b/zellij-tile/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij-tile" -version = "0.36.0" +version = "0.37.0" authors = ["Brooks J Rady <b.j.rady@gmail.com>"] edition = "2021" description = "A small client-side library for writing Zellij plugins" @@ -12,4 +12,4 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" strum = "0.20.0" strum_macros = "0.20.0" -zellij-utils = { path = "../zellij-utils/", version = "0.36.0" } +zellij-utils = { path = "../zellij-utils/", version = "0.37.0" } diff --git a/zellij-utils/Cargo.toml b/zellij-utils/Cargo.toml index b6f362798..76ca72c90 100644 --- a/zellij-utils/Cargo.toml +++ b/zellij-utils/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "zellij-utils" -version = "0.36.0" +version = "0.37.0" authors = ["Kunal Mohan <kunalmohan99@gmail.com>"] edition = "2021" description = "A utility library for Zellij client and server" diff --git a/zellij-utils/assets/plugins/compact-bar.wasm b/zellij-utils/assets/plugins/compact-bar.wasm Binary files differindex c69ee88e3..00d14d0ea 100755 --- a/zellij-utils/assets/plugins/compact-bar.wasm +++ b/zellij-utils/assets/plugins/compact-bar.wasm diff --git a/zellij-utils/assets/plugins/status-bar.wasm b/zellij-utils/assets/plugins/status-bar.wasm Binary files differindex a9ae76916..66e6b10d4 100755 --- a/zellij-utils/assets/plugins/status-bar.wasm +++ b/zellij-utils/assets/plugins/status-bar.wasm diff --git a/zellij-utils/assets/plugins/strider.wasm b/zellij-utils/assets/plugins/strider.wasm Binary files differindex 5e4a54f95..287385a54 100755 --- a/zellij-utils/assets/plugins/strider.wasm +++ b/zellij-utils/assets/plugins/strider.wasm diff --git a/zellij-utils/assets/plugins/tab-bar.wasm b/zellij-utils/assets/plugins/tab-bar.wasm Binary files differindex 8ea487d87..b22bcf103 100755 --- a/zellij-utils/assets/plugins/tab-bar.wasm +++ b/zellij-utils/assets/plugins/tab-bar.wasm |