mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
cursor position absolute needs to ignore all the offset stuff
This commit is contained in:
@ -706,13 +706,7 @@ pub fn setCursorUp(self: *Window, amount: u16) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn setCursorCol(self: *Window, col: u16) !void {
|
pub fn setCursorCol(self: *Window, col: u16) !void {
|
||||||
if (self.terminal.modes.origin == 1) {
|
self.terminal.setCursorColAbsolute(col);
|
||||||
// TODO
|
|
||||||
log.err("setCursorCol: implement origin mode", .{});
|
|
||||||
unreachable;
|
|
||||||
}
|
|
||||||
|
|
||||||
self.terminal.setCursorPos(self.terminal.screen.cursor.y + 1, col);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn setCursorRow(self: *Window, row: u16) !void {
|
pub fn setCursorRow(self: *Window, row: u16) !void {
|
||||||
|
@ -463,6 +463,21 @@ pub fn setCursorPos(self: *Terminal, row_req: usize, col_req: usize) void {
|
|||||||
self.screen.cursor.pending_wrap = false;
|
self.screen.cursor.pending_wrap = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Move the cursor to column `col_req` (1-indexed) without modifying the row.
|
||||||
|
/// If `col_req` is 0, it is changed to 1. If `col_req` is greater than the
|
||||||
|
/// total number of columns, it is set to the right-most column.
|
||||||
|
///
|
||||||
|
/// If cursor origin mode is set, the cursor row will be set inside the
|
||||||
|
/// current scroll region.
|
||||||
|
pub fn setCursorColAbsolute(self: *Terminal, col_req: usize) void {
|
||||||
|
// TODO: test
|
||||||
|
|
||||||
|
assert(self.modes.origin == 0); // TODO
|
||||||
|
|
||||||
|
const col = if (col_req == 0) 1 else col_req;
|
||||||
|
self.screen.cursor.x = @minimum(self.cols, col) - 1;
|
||||||
|
}
|
||||||
|
|
||||||
/// Erase the display.
|
/// Erase the display.
|
||||||
/// TODO: test
|
/// TODO: test
|
||||||
pub fn eraseDisplay(
|
pub fn eraseDisplay(
|
||||||
|
Reference in New Issue
Block a user