style: move leading padding inside first tab

This commit is contained in:
Valdemar Lorenzen
2026-10-12 10:52:45 +02:00
parent 393791ab7e
commit 05d62aa4a5
2 changed files with 6 additions and 7 deletions
+5 -6
View File
@@ -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 })