mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-17 09:16:11 +03:00
@ -1008,10 +1008,14 @@ pub fn setCursorColAbsolute(self: *Terminal, col_req: usize) void {
|
||||
return;
|
||||
}
|
||||
|
||||
if (self.status_display != .main) return; // TODO
|
||||
if (self.status_display != .main) {
|
||||
log.err("setCursorColAbsolute: not implemented on status display", .{});
|
||||
return; // TODO
|
||||
}
|
||||
|
||||
const col = if (col_req == 0) 1 else col_req;
|
||||
self.screen.cursor.x = @min(self.cols, col) - 1;
|
||||
self.screen.cursor.pending_wrap = false;
|
||||
}
|
||||
|
||||
/// Erase the display.
|
||||
@ -2743,6 +2747,18 @@ test "Terminal: deleteChars should shift left" {
|
||||
}
|
||||
}
|
||||
|
||||
test "Terminal: setCursorColAbsolute resets pending wrap" {
|
||||
const alloc = testing.allocator;
|
||||
var t = try init(alloc, 5, 5);
|
||||
defer t.deinit(alloc);
|
||||
|
||||
for ("ABCDE") |c| try t.print(c);
|
||||
try testing.expect(t.screen.cursor.pending_wrap);
|
||||
t.setCursorColAbsolute(1);
|
||||
try testing.expect(!t.screen.cursor.pending_wrap);
|
||||
try testing.expectEqual(@as(usize, 0), t.screen.cursor.x);
|
||||
}
|
||||
|
||||
// https://github.com/mitchellh/ghostty/issues/272
|
||||
// This is also tested in depth in screen resize tests but I want to keep
|
||||
// this test around to ensure we don't regress at multiple layers.
|
||||
|
Reference in New Issue
Block a user