mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
terminal: deleteChars resets row wrap state
This commit is contained in:
@ -1623,6 +1623,9 @@ pub fn deleteChars(self: *Terminal, count_req: usize) void {
|
||||
if (self.screen.cursor.x < self.scrolling_region.left or
|
||||
self.screen.cursor.x > self.scrolling_region.right) return;
|
||||
|
||||
// This resets the soft-wrap of this line
|
||||
self.screen.cursor.page_row.wrap = false;
|
||||
|
||||
// This resets the pending wrap state
|
||||
self.screen.cursor.pending_wrap = false;
|
||||
|
||||
@ -6638,7 +6641,7 @@ test "Terminal: deleteChars should shift left" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: deleteChars resets wrap" {
|
||||
test "Terminal: deleteChars resets pending wrap" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, .{ .rows = 5, .cols = 5 });
|
||||
defer t.deinit(alloc);
|
||||
@ -6656,6 +6659,35 @@ test "Terminal: deleteChars resets wrap" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: deleteChars resets wrap" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, .{ .rows = 5, .cols = 5 });
|
||||
defer t.deinit(alloc);
|
||||
|
||||
for ("ABCDE123") |c| try t.print(c);
|
||||
{
|
||||
const list_cell = t.screen.pages.getCell(.{ .active = .{ .x = 0, .y = 0 } }).?;
|
||||
const row = list_cell.row;
|
||||
try testing.expect(row.wrap);
|
||||
}
|
||||
t.setCursorPos(1, 1);
|
||||
t.deleteChars(1);
|
||||
|
||||
{
|
||||
const list_cell = t.screen.pages.getCell(.{ .active = .{ .x = 0, .y = 0 } }).?;
|
||||
const row = list_cell.row;
|
||||
try testing.expect(!row.wrap);
|
||||
}
|
||||
|
||||
try t.print('X');
|
||||
|
||||
{
|
||||
const str = try t.plainString(testing.allocator);
|
||||
defer testing.allocator.free(str);
|
||||
try testing.expectEqualStrings("XCDE\n123", str);
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: deleteChars simple operation" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, .{ .cols = 10, .rows = 10 });
|
||||
|
Reference in New Issue
Block a user