aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2026-07-17 12:31:19 +0200
committerGitHub <noreply@github.com>2026-07-17 12:31:19 +0200
commit1889819b52b3821e4639fdffdd69e978016ca0f9 (patch)
treea62749b30b06ffa2ccdaf43bbb72e49702908883 /zellij-server
parentfix(grid): scroll the region when a line wraps at its bottom margin (#5357) (diff)
downloadsl0ppij-1889819b52b3821e4639fdffdd69e978016ca0f9.tar.gz
sl0ppij-1889819b52b3821e4639fdffdd69e978016ca0f9.tar.xz
sl0ppij-1889819b52b3821e4639fdffdd69e978016ca0f9.zip
fix(grid): properly pad rows in CUF (#5377)
* fix(grid): properly pad rows in CUF * add pr
Diffstat (limited to 'zellij-server')
-rw-r--r--zellij-server/src/panes/grid.rs5
-rw-r--r--zellij-server/src/panes/unit/grid_tests.rs27
2 files changed, 30 insertions, 2 deletions
diff --git a/zellij-server/src/panes/grid.rs b/zellij-server/src/panes/grid.rs
index 5be48d34..ab87a2fe 100644
--- a/zellij-server/src/panes/grid.rs
+++ b/zellij-server/src/panes/grid.rs
@@ -1916,8 +1916,9 @@ impl Grid {
for _ in self.viewport.len()..self.cursor.y {
self.viewport.push_back(Row::new().canonical());
}
- self.viewport
- .push_back(Row::new().with_character(terminal_character).canonical());
+ let mut new_row = Row::new().canonical();
+ new_row.add_character_at(terminal_character, self.cursor.x);
+ self.viewport.push_back(new_row);
self.output_buffer.update_line(self.cursor.y);
},
}
diff --git a/zellij-server/src/panes/unit/grid_tests.rs b/zellij-server/src/panes/unit/grid_tests.rs
index ac697956..e21ea867 100644
--- a/zellij-server/src/panes/unit/grid_tests.rs
+++ b/zellij-server/src/panes/unit/grid_tests.rs
@@ -4257,6 +4257,33 @@ fn create_grid_with_content(content: &str) -> Grid {
}
#[test]
+fn cursor_forward_over_unwritten_line_positions_character() {
+ use crate::panes::terminal_character::AnsiCode;
+
+ let content = "\u{1b}[1BABC \u{1b}[1B\r\u{1b}[3C\u{1b}[42mDEF\u{1b}[0m";
+ let grid = create_grid_with_content(content);
+
+ let row = &grid.viewport[2];
+
+ assert_eq!(row.columns[0].character, ' ');
+ assert_eq!(row.columns[1].character, ' ');
+ assert_eq!(row.columns[2].character, ' ');
+ assert_eq!(row.columns[3].character, 'D');
+ assert_eq!(row.columns[4].character, 'E');
+ assert_eq!(row.columns[5].character, 'F');
+
+ let has_background = |c: &crate::panes::terminal_character::TerminalCharacter| {
+ !matches!(c.styles.background, Some(AnsiCode::Reset) | None)
+ };
+ assert!(!has_background(&row.columns[0]));
+ assert!(!has_background(&row.columns[1]));
+ assert!(!has_background(&row.columns[2]));
+ assert!(has_background(&row.columns[3]));
+ assert!(has_background(&row.columns[4]));
+ assert!(has_background(&row.columns[5]));
+}
+
+#[test]
fn double_click_selection_preserved_after_scroll() {
let content = "line 0\nline 1\nline 2\nline 3\nline 4\nthis is a word test\nline 6\nline 7\nline 8\nline 9\nline 10\nline 11\nline 12\nline 13\nline 14\nline 15\nline 16\nline 17\nline 18\nline 19\n";
let mut grid = create_grid_with_content(content);