From ac5c64981d7b6b6072449964fc91d62baaee365b Mon Sep 17 00:00:00 2001 From: hl-valdemar Date: Thu, 22 Oct 2026 19:21:53 +0200 Subject: [PATCH] fix: display diff totals as plain status text --- docs/configuration.md | 2 +- src/chrome.rs | 6 +++--- src/tui.rs | 2 +- tests/unit/chrome.rs | 1 - 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/docs/configuration.md b/docs/configuration.md index ff23dd8..22fd2d9 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -172,7 +172,7 @@ Each segment's `title` is a literal template supporting only `{index}`, `{view}` `margin` adds unstyled space outside both edges of a segment, unlike the styled internal `padding`. `leading_margin` and `trailing_margin` override their respective sides. All accept integers from `0` through `64`; all margins default to zero. Explicit margins are additional to the renderer's one-column separator, so leave them at zero for normal inter-item spacing. Margins count toward anchor placement and collision handling; empty segments consume no margin, and margins yield along with padding and edges when only clipped content fits. -`padding` adds spaces inside the segment's styling, on both sides of its title, and accepts integers from `0` through `64`. It defaults to `0` for plain-text and custom segments and `1` for tabs, mode, position, battery, diff totals, shell status, and LSP indicators. Internal padding is separate from the inter-item separator; explicit padding can deliberately add more whitespace. `leading_edge` and `trailing_edge` are separate styled glyph strings, not padding; `""` removes an edge. Tabs, diff totals, and shell status default to `"░▓"` / `"▓░"` edges; mode has only the trailing `"▓░"` edge, position and battery only the leading `"░▓"` edge, and other segments have none. `first_leading_edge` optionally overrides the first occurrence's leading glyphs: for tabs this is the actual first tab, not the first tab remaining after clipping; other segments have one occurrence. Tabs default this override to `""`, suppressing the first tab's left fade. Unicode widths are measured in terminal cells. Edge strings must be single-line and contain no control characters. Unknown style keys, invalid templates, and wrong types reject configuration. +`padding` adds spaces inside the segment's styling, on both sides of its title, and accepts integers from `0` through `64`. It defaults to `0` for plain-text and custom segments and `1` for tabs, mode, position, battery, shell status, and LSP indicators. Diff totals use plain text without a filled background, padding, or edges by default. Internal padding is separate from the inter-item separator; explicit padding can deliberately add more whitespace. `leading_edge` and `trailing_edge` are separate styled glyph strings, not padding; `""` removes an edge. Tabs and shell status default to `"░▓"` / `"▓░"` edges; mode has only the trailing `"▓░"` edge, position and battery only the leading `"░▓"` edge, and other segments have none. `first_leading_edge` optionally overrides the first occurrence's leading glyphs: for tabs this is the actual first tab, not the first tab remaining after clipping; other segments have one occurrence. Tabs default this override to `""`, suppressing the first tab's left fade. Unicode widths are measured in terminal cells. Edge strings must be single-line and contain no control characters. Unknown style keys, invalid templates, and wrong types reject configuration. Any other segment name is a custom named value, such as `:build_status`. Set initial strings with `config.labels`; an empty value hides the custom segment, including its title override, margins, padding, and edges. Names match `[A-Za-z_][A-Za-z0-9_]*`. Labels are plain text: control characters are replaced rather than interpreted as terminal escapes. The same named value can appear in either bar. diff --git a/src/chrome.rs b/src/chrome.rs index b42a87c..dce5ea1 100644 --- a/src/chrome.rs +++ b/src/chrome.rs @@ -195,15 +195,15 @@ impl ChromeLine { fn default_segment(name: &str) -> SegmentConfig { let mut segment = SegmentConfig::default(); - if matches!(name, "tabs" | "position" | "battery" | "shell" | "diff") { + if matches!(name, "tabs" | "position" | "battery" | "shell") { segment.leading_edge = "░▓".into(); } - if matches!(name, "tabs" | "mode" | "shell" | "diff") { + if matches!(name, "tabs" | "mode" | "shell") { segment.trailing_edge = "▓░".into(); } if matches!( name, - "tabs" | "mode" | "position" | "battery" | "shell" | "diff" | "lsp" + "tabs" | "mode" | "position" | "battery" | "shell" | "lsp" ) { segment.padding = 1; } diff --git a/src/tui.rs b/src/tui.rs index b98ff13..a30e912 100644 --- a/src/tui.rs +++ b/src/tui.rs @@ -1823,7 +1823,7 @@ fn chrome_items<'a>( tab: None, accent: !matches!( name.as_str(), - "path" | "language" | "diagnostics" | "selections" | "count" | "pending" | "buffer" + "path" | "language" | "diagnostics" | "selections" | "count" | "pending" | "buffer" | "diff" ), bold: false, first: true, diff --git a/tests/unit/chrome.rs b/tests/unit/chrome.rs index cc4b777..b99880d 100644 --- a/tests/unit/chrome.rs +++ b/tests/unit/chrome.rs @@ -79,7 +79,6 @@ fn omitted_options_inherit_and_explicit_groups_replace_defaults() { fn both_positions_accept_all_builtins_and_custom_styles() { let defaults = ChromeLine::top(); assert_eq!(defaults.right, ["diff", "shell", "battery"]); - assert_eq!(defaults.segment("diff"), defaults.segment("shell")); let names = [ "tabs", "mode",