diff options
| author | user <user@clank> | 2026-08-08 19:31:55 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-08 19:31:55 +0200 |
| commit | 3f767ee91b08eebf10b693c08c173b8329ba2c14 (patch) | |
| tree | 6f2b7feed0f454f8a6036fbef54b2d647f35462d /zellij-utils/src/kdl | |
| parent | sl0p: rebuilt default plugin wasm assets (diff) | |
| download | sl0ppij-3f767ee91b08eebf10b693c08c173b8329ba2c14.tar.gz sl0ppij-3f767ee91b08eebf10b693c08c173b8329ba2c14.tar.xz sl0ppij-3f767ee91b08eebf10b693c08c173b8329ba2c14.zip | |
sl0p: configurable pane title alignment
Adds `ui { pane_frames { title_alignment "left"|"center"|"right" } }`.
Full-frame panes previously hardcoded the title flush left, while frameless
panes (pane_frame_style "titles") already centered it via
compose_bracketed_title. This brings full frames up to parity and makes the
position configurable.
Implementation notes:
- The value rides on `Style`, which is already threaded to FrameParams, so no
new plumbing through Tab/PaneContentsAndUi was needed.
- It is deliberately NOT round-tripped over the plugin protobuf boundary:
plugins have no use for frame title alignment and adding a proto field
would force regenerating the committed prost assets in assets/prost/.
- Left keeps the original code path untouched, so default configs render
exactly as before.
- The geometry loop clamps the title start against the right-side indicators
and breaks on `>=` rather than `==`, so a mis-clamped segment cannot spin.
Tests: alignment ordering, frame width preservation across widths, and
narrow-pane safety (cols 1..24 must not panic or corrupt width).
Diffstat (limited to 'zellij-utils/src/kdl')
| -rw-r--r-- | zellij-utils/src/kdl/mod.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/zellij-utils/src/kdl/mod.rs b/zellij-utils/src/kdl/mod.rs index 8e86445f..bc188aed 100644 --- a/zellij-utils/src/kdl/mod.rs +++ b/zellij-utils/src/kdl/mod.rs @@ -5524,9 +5524,21 @@ impl UiConfig { .unwrap_or(false); let hide_session_name = kdl_get_child_entry_bool_value!(pane_frames, "hide_session_name").unwrap_or(false); + let title_alignment = match kdl_children_property_first_arg_as_string!( + pane_frames, + "title_alignment" + ) { + Some(string) => { + crate::data::PaneTitleAlignment::from_str(string).map_err(|e| { + ConfigError::new_kdl_error(e, kdl_ui_config.span().offset(), kdl_ui_config.span().len()) + })? + }, + None => crate::data::PaneTitleAlignment::default(), + }; let frame_config = FrameConfig { rounded_corners, hide_session_name, + title_alignment, }; ui_config.pane_frames = frame_config; } @@ -5550,6 +5562,19 @@ impl UiConfig { hide_session_name.push(KdlValue::Bool(true)); frame_config_children.nodes_mut().push(hide_session_name); } + if self.pane_frames.title_alignment != crate::data::PaneTitleAlignment::default() { + has_ui_config = true; + let mut title_alignment = KdlNode::new("title_alignment"); + title_alignment.push(KdlValue::String( + match self.pane_frames.title_alignment { + crate::data::PaneTitleAlignment::Left => "left", + crate::data::PaneTitleAlignment::Center => "center", + crate::data::PaneTitleAlignment::Right => "right", + } + .to_string(), + )); + frame_config_children.nodes_mut().push(title_alignment); + } if has_ui_config { frame_config.set_children(frame_config_children); ui_config_children.nodes_mut().push(frame_config); |
