style: omit leading fade on leftmost tab

This commit is contained in:
Valdemar Lorenzen
2026-10-12 10:47:41 +02:00
parent 9dd6a666d0
commit 393791ab7e
2 changed files with 7 additions and 5 deletions
+1 -1
View File
@@ -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.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 | | `: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 `░▒▓` / `▓▒░`; 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 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`.
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. 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.
+6 -4
View File
@@ -1041,8 +1041,10 @@ fn draw_tab_bar(frame: &mut Frame, editor: &Editor, area: Rect) -> Rect {
let active = editor.tab_index(); let active = editor.tab_index();
let mut first = active; let mut first = active;
let padding = u16::from(bar.width > 1); let padding = u16::from(bar.width > 1);
let fade = usize::from(bar.width) >= labels[active].width() + usize::from(padding) + 6; let fade_width = if active == 0 { 3 } else { 6 };
let mut width = labels[active].width() + usize::from(padding) + if fade { 6 } else { 0 }; 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 };
while first > 0 && width + labels[first - 1].width() <= usize::from(bar.width) { while first > 0 && width + labels[first - 1].width() <= usize::from(bar.width) {
first -= 1; first -= 1;
width += labels[first].width(); width += labels[first].width();
@@ -1051,7 +1053,7 @@ fn draw_tab_bar(frame: &mut Frame, editor: &Editor, area: Rect) -> Rect {
let mut x = bar.x + padding; let mut x = bar.x + padding;
for (index, label) in labels.iter().enumerate().skip(first) { for (index, label) in labels.iter().enumerate().skip(first) {
let decorated = index == active && fade; let decorated = index == active && fade;
let width = (label.width() + if decorated { 6 } else { 0 }) let width = (label.width() + if decorated { fade_width } else { 0 })
.min(usize::from(bar.right() - x)) as u16; .min(usize::from(bar.right() - x)) as u16;
let highlight = Style::default() let highlight = Style::default()
.fg(Color::Black) .fg(Color::Black)
@@ -1060,7 +1062,7 @@ fn draw_tab_bar(frame: &mut Frame, editor: &Editor, area: Rect) -> Rect {
let edge = Style::default().fg(Color::Cyan); let edge = Style::default().fg(Color::Cyan);
let line = if decorated { let line = if decorated {
Line::from(vec![ Line::from(vec![
Span::styled("░▒▓", edge), Span::styled(if index == 0 { "" } else { "░▒▓" }, edge),
Span::styled(label.as_str(), highlight), Span::styled(label.as_str(), highlight),
Span::styled("▓▒░", edge), Span::styled("▓▒░", edge),
]) ])