From 05d62aa4a593cb3f7241829a40b3b69ea0544c48 Mon Sep 17 00:00:00 2001 From: Valdemar Lorenzen Date: Mon, 12 Oct 2026 10:52:45 +0200 Subject: [PATCH] style: move leading padding inside first tab --- docs/editing.md | 2 +- src/tui.rs | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/editing.md b/docs/editing.md index a6a2554..9f3bf85 100644 --- a/docs/editing.md +++ b/docs/editing.md @@ -218,7 +218,7 @@ Use `:tab.new` to open the current buffer in a new, focused tab with one pane. E | `:tab.close` | `config.core.tab.close` | Close the current tab and all its panes, protecting unsaved changes | | `:tab.force_close` | `config.core.tab.force_close` | Explicitly discard exclusively displayed edits and close the tab | -Multiple tabs show a single top row with padded numbered filenames and dirty markers. The active tab has an accent-colored background fading into the terminal background through `░▒▓` / `▓▒░`, except the first tab has no left fade; inactive tabs remain unfilled. Narrow terminals omit the fade before clipping the active title. The status bar uses the same fade around its mode and right-aligned caret position, leaving file metadata unfilled. New/close actions have no default keybinding; for example, `config.bind "leader t", config.core.tab.new`. +Multiple tabs show a single top row with numbered filenames and dirty markers, with padding inside each tab's styling. The active tab has an accent-colored background fading into the terminal background through `░▒▓` / `▓▒░`, except the first tab has no left fade; inactive tabs remain unfilled. Narrow terminals omit the fade before clipping the active title. The status bar uses the same fade around its mode and right-aligned caret position, leaving file metadata unfilled. New/close actions have no default keybinding; for example, `config.bind "leader t", config.core.tab.new`. Closing a tab refuses dirty buffers whose final displayed owner would disappear, including a comparison's working and return buffers. Buffers displayed in another tab remain open with their edits, even on force-close. Other hidden buffers remain loaded. Closing the last tab quits only if every open buffer is clean; force-close quits without saving. diff --git a/src/tui.rs b/src/tui.rs index c0c37a7..552c532 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -1028,7 +1028,8 @@ fn draw_tab_bar(frame: &mut Frame, editor: &Editor, area: Rect) -> Rect { }) .unwrap_or(Cow::Borrowed("[No Name]")); display_text(&format!( - "{} {name}{} ", + "{}{} {name}{} ", + if bar.width > 1 { " " } else { "" }, index + 1, if buffer.is_some_and(|buffer| buffer.dirty) { " [+]" @@ -1040,17 +1041,15 @@ fn draw_tab_bar(frame: &mut Frame, editor: &Editor, area: Rect) -> Rect { .collect(); let active = editor.tab_index(); let mut first = active; - let padding = u16::from(bar.width > 1); let fade_width = if active == 0 { 3 } else { 6 }; - let fade = usize::from(bar.width) >= labels[active].width() + usize::from(padding) + fade_width; - let mut width = - labels[active].width() + usize::from(padding) + if fade { fade_width } else { 0 }; + let fade = usize::from(bar.width) >= labels[active].width() + fade_width; + let mut width = labels[active].width() + if fade { fade_width } else { 0 }; while first > 0 && width + labels[first - 1].width() <= usize::from(bar.width) { first -= 1; width += labels[first].width(); } let inactive = Style::default().fg(Color::Gray); - let mut x = bar.x + padding; + let mut x = bar.x; for (index, label) in labels.iter().enumerate().skip(first) { let decorated = index == active && fade; let width = (label.width() + if decorated { fade_width } else { 0 })