aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/panes/grid.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-02-05 11:02:39 +0100
committerGitHub <noreply@github.com>2026-02-05 11:02:39 +0100
commita5f6ac81f477a7dbfb3c0398c562016e24c09ba9 (patch)
treecf49041da9bc7aed50d3b23952757d3ccec45820 /zellij-server/src/panes/grid.rs
parentAllow resizing panes with the mouse (#4678) (diff)
downloadsl0ppij-a5f6ac81f477a7dbfb3c0398c562016e24c09ba9.tar.gz
sl0ppij-a5f6ac81f477a7dbfb3c0398c562016e24c09ba9.tar.xz
sl0ppij-a5f6ac81f477a7dbfb3c0398c562016e24c09ba9.zip
fix: don't trim empty characters with background (#4680)
* fix: take background color into account when trimming characters * add pr
Diffstat (limited to 'zellij-server/src/panes/grid.rs')
-rw-r--r--zellij-server/src/panes/grid.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 4d17972e..ee88e40c 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -861,9 +861,17 @@ impl Grid {
for line in &mut viewport_canonical_lines {
let mut trim_at = None;
for (index, character) in line.columns.iter().enumerate() {
- if character.character != EMPTY_TERMINAL_CHARACTER.character {
+ let is_trimmable_space = character.character
+ == EMPTY_TERMINAL_CHARACTER.character
+ && matches!(character.styles.background, Some(AnsiCode::Reset) | None);
+
+ if !is_trimmable_space {
+ // we can't trim this character, meaning that if we had a previous
+ // character that we marked as the trim_at point, we need to clear it
trim_at = None;
} else if trim_at.is_none() {
+ // we CAN trim this character, set the trim_at point only if it's not set
+ // because we want the trim_at point to be the EARLIEST trimmable character
trim_at = Some(index);
}
}