diff options
| author | user <user@clank> | 2026-08-08 19:09:58 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-08 19:09:58 +0200 |
| commit | aa51848d634d5b50940a14e9a97bc9f44797d490 (patch) | |
| tree | eb02fae60989e6bd563f8f3b5563a4dda93da936 /zellij-server | |
| parent | Support the Kitty Image Protocol (#5428) (diff) | |
| download | sl0ppij-aa51848d634d5b50940a14e9a97bc9f44797d490.tar.gz sl0ppij-aa51848d634d5b50940a14e9a97bc9f44797d490.tar.xz sl0ppij-aa51848d634d5b50940a14e9a97bc9f44797d490.zip | |
sl0p: compact scroll indicator + sl0p.foo tab-bar branding
- pane_boundaries_frame: replace 'SCROLL: 42/1000' with a single-glyph
indicator ('up-arrow'42), and only show it when actually scrolled up
rather than whenever scrollback exists.
- tab-bar: rebrand the prefix to sl0p.foo.
Pre-existing local work, committed as the base of the sl0p fork.
Diffstat (limited to 'zellij-server')
| -rw-r--r-- | zellij-server/src/ui/pane_boundaries_frame.rs | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/zellij-server/src/ui/pane_boundaries_frame.rs b/zellij-server/src/ui/pane_boundaries_frame.rs index f5347f3f..955f161e 100644 --- a/zellij-server/src/ui/pane_boundaries_frame.rs +++ b/zellij-server/src/ui/pane_boundaries_frame.rs @@ -16,6 +16,11 @@ use zellij_utils::position::Position; use unicode_width::{UnicodeWidthChar, UnicodeWidthStr}; +// Compact scroll indication (instead of the noisy "SCROLL: 42/1000"): +// a single glyph plus how many lines we are scrolled up, eg. "↑42". +// Set to "^" if your font renders the arrow double-width. +const SCROLL_GLYPH: &str = "↑"; + fn styled_characters( characters: &str, style_character: impl Fn(&mut CharacterStyles), @@ -227,7 +232,9 @@ impl PaneFrame { max_length: usize, ) -> Option<(Vec<TerminalCharacter>, usize)> { // string and length because of color - let has_scroll = self.scroll_position.0 > 0 || self.scroll_position.1 > 0; + // only indicate scroll when actually scrolled up, not merely when + // scrollback exists (scroll_position.1 > 0), which is almost always + let has_scroll = self.scroll_position.0 > 0; if has_scroll && self.is_selectable { // TODO: don't show SCROLL at all for plugins let pin_indication = if self.is_floating && self.is_selectable { @@ -265,18 +272,11 @@ impl PaneFrame { &self, max_length: usize, ) -> Option<(Vec<TerminalCharacter>, usize)> { - let prefix = " SCROLL: "; - let full_indication = format!(" {}/{} ", self.scroll_position.0, self.scroll_position.1); - let short_indication = format!(" {} ", self.scroll_position.0); - let full_indication_len = full_indication.chars().count(); - let short_indication_len = short_indication.chars().count(); - let prefix_len = prefix.chars().count(); - if prefix_len + full_indication_len <= max_length { - Some(( - foreground_color(&format!("{}{}", prefix, full_indication), self.color), - prefix_len + full_indication_len, - )) - } else if full_indication_len <= max_length { + let full_indication = format!(" {}{} ", SCROLL_GLYPH, self.scroll_position.0); + let short_indication = format!(" {} ", SCROLL_GLYPH); + let full_indication_len = full_indication.width(); + let short_indication_len = short_indication.width(); + if full_indication_len <= max_length { Some(( foreground_color(&full_indication, self.color), full_indication_len, @@ -915,19 +915,16 @@ impl PaneFrame { &self, max_length: usize, ) -> Option<(Vec<TerminalCharacter>, usize)> { - let has_scroll = self.scroll_position.0 > 0 || self.scroll_position.1 > 0; + let has_scroll = self.scroll_position.0 > 0; if !(has_scroll && self.is_selectable) { return None; } - let full_indication = format!( - "SCROLL: {}/{}", - self.scroll_position.0, self.scroll_position.1 - ); + let full_indication = format!("{}{}", SCROLL_GLYPH, self.scroll_position.0); let (full_part, full_length) = self.bracketed_title_part(&full_indication); if full_length <= max_length { return Some((full_part, full_length)); } - let short_indication = format!("{}/{}", self.scroll_position.0, self.scroll_position.1); + let short_indication = SCROLL_GLYPH.to_string(); let (short_part, short_length) = self.bracketed_title_part(&short_indication); if short_length <= max_length { return Some((short_part, short_length)); |
