aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoruser <user@clank>2026-08-11 16:53:54 +0200
committeruser <user@clank>2026-08-11 16:53:54 +0200
commit54855382d99dcad66245085aa9f03384d1ac271b (patch)
tree9bee6a73f2fe5c177c531b84af8035bdfb0b9514
parentsl0p: clear the stale picker region when the layout re-flows (diff)
downloadsl0ppij-54855382d99dcad66245085aa9f03384d1ac271b.tar.gz
sl0ppij-54855382d99dcad66245085aa9f03384d1ac271b.tar.xz
sl0ppij-54855382d99dcad66245085aa9f03384d1ac271b.zip
sl0p: warn when the responsive layout has no swap layout to collapse into
The collapse selects a swap layout BY NAME, so a tab with no swap layouts simply does nothing when the terminal gets narrow -- no error, no hint. The usual cause is not the responsive settings at all: a custom layout file only gets swap layouts from a sibling "<layout>.swap.kdl", so launching with one that has no such file silently disables the feature. That is the second time this feature has failed invisibly (the first was a layout marked damaged), and both cost real debugging time. Logs once per tab, not per resize, and names the actual cause rather than the symptom.
-rw-r--r--zellij-server/src/tab/mod.rs23
1 files changed, 20 insertions, 3 deletions
diff --git a/zellij-server/src/tab/mod.rs b/zellij-server/src/tab/mod.rs
index 8ff62e07..ad17c76d 100644
--- a/zellij-server/src/tab/mod.rs
+++ b/zellij-server/src/tab/mod.rs
@@ -388,6 +388,8 @@ pub(crate) struct Tab {
expanded_stack_lists: HashSet<StackListId>,
/// Pack picker entries into a grid rather than one per row.
stack_list_grid: bool,
+ /// So the "no such swap layout" warning is logged once, not per resize.
+ responsive_missing_layout_warned: bool,
currently_marking_pane_group: Rc<RefCell<HashMap<ClientId, bool>>>,
connected_clients_in_app: Rc<RefCell<HashMap<ClientId, bool>>>, // bool -> is_web_client
// the below are the configured values - the ones that will be set if and when the web server
@@ -1206,6 +1208,7 @@ impl Tab {
stack_list_max_rows: 0,
expanded_stack_lists: HashSet::new(),
stack_list_grid: false,
+ responsive_missing_layout_warned: false,
connected_clients_in_app,
web_server_ip,
web_server_port,
@@ -5510,10 +5513,24 @@ impl Tab {
let target_position = match (self.responsive_restore_position, too_narrow, wide_again) {
// collapse: remember where we were, go to the responsive layout
(None, true, _) => {
- let Some(position) = self
+ let position = self
.swap_layouts
- .position_of_tiled_layout_named(&self.responsive_layout_name)
- else {
+ .position_of_tiled_layout_named(&self.responsive_layout_name);
+ let Some(position) = position else {
+ // Loud, because the failure is otherwise invisible: the
+ // terminal just does not collapse, and the usual cause is a
+ // layout with no swap layouts at all rather than anything
+ // about the responsive settings. Once per tab, since this
+ // runs on every resize.
+ if !self.responsive_missing_layout_warned {
+ self.responsive_missing_layout_warned = true;
+ log::warn!(
+ "responsive_min_cols is set, but this tab has no swap layout named {:?}, so it cannot collapse. \
+ Swap layouts come from a `<layout>.swap.kdl` file next to your layout file, \
+ or from `swap_tiled_layout` nodes inside it.",
+ self.responsive_layout_name
+ );
+ }
return Ok(());
};
self.responsive_restore_position =