mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
terminal: insert blanks (ICH) with left/right and large count
This commit is contained in:
@ -1655,7 +1655,7 @@ pub fn insertBlanks(self: *Terminal, count: usize) void {
|
||||
|
||||
// Determine our indexes.
|
||||
const start = self.screen.cursor.x;
|
||||
const pivot = self.screen.cursor.x + count;
|
||||
const pivot = @min(self.screen.cursor.x + count, right_limit);
|
||||
|
||||
// This is the number of spaces we have left to shift existing data.
|
||||
// If count is bigger than the available space left after the cursor,
|
||||
@ -4289,6 +4289,25 @@ test "Terminal: insertBlanks outside left/right scroll region" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: insertBlanks left/right scroll region large count" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, 10, 10);
|
||||
defer t.deinit(alloc);
|
||||
|
||||
t.modes.set(.origin, true);
|
||||
t.modes.set(.enable_left_and_right_margin, true);
|
||||
t.setLeftAndRightMargin(3, 5);
|
||||
t.setCursorPos(1, 1);
|
||||
t.insertBlanks(140);
|
||||
try t.print('X');
|
||||
|
||||
{
|
||||
var str = try t.plainString(testing.allocator);
|
||||
defer testing.allocator.free(str);
|
||||
try testing.expectEqualStrings(" X", str);
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: insert mode with space" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, 10, 2);
|
||||
|
Reference in New Issue
Block a user