mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
cursor left
This commit is contained in:
@ -547,6 +547,10 @@ pub fn carriageReturn(self: *Window) !void {
|
||||
self.terminal.carriageReturn();
|
||||
}
|
||||
|
||||
pub fn setCursorLeft(self: *Window, amount: u16) !void {
|
||||
self.terminal.cursorLeft(amount);
|
||||
}
|
||||
|
||||
pub fn setCursorRight(self: *Window, amount: u16) !void {
|
||||
self.terminal.cursorRight(amount);
|
||||
}
|
||||
|
@ -358,6 +358,17 @@ pub fn eraseChars(self: *Terminal, alloc: Allocator, count: usize) !void {
|
||||
}
|
||||
}
|
||||
|
||||
/// Move the cursor to the left amount cells. If amount is 0, adjust it to 1.
|
||||
/// TODO: test
|
||||
pub fn cursorLeft(self: *Terminal, count: usize) void {
|
||||
const tracy = trace(@src());
|
||||
defer tracy.end();
|
||||
|
||||
// TODO: scroll region, wrap
|
||||
|
||||
self.cursor.x -|= if (count == 0) 1 else count;
|
||||
}
|
||||
|
||||
/// Move the cursor right amount columns. If amount is greater than the
|
||||
/// maximum move distance then it is internally adjusted to the maximum.
|
||||
/// This sequence will not scroll the screen or scroll region. If amount is
|
||||
|
@ -131,6 +131,18 @@ pub fn Stream(comptime Handler: type) type {
|
||||
},
|
||||
) else log.warn("unimplemented CSI callback: {}", .{action}),
|
||||
|
||||
// CUB - Cursor Left
|
||||
'D' => if (@hasDecl(T, "setCursorLeft")) try self.handler.setCursorLeft(
|
||||
switch (action.params.len) {
|
||||
0 => 1,
|
||||
1 => action.params[0],
|
||||
else => {
|
||||
log.warn("invalid cursor left command: {}", .{action});
|
||||
return;
|
||||
},
|
||||
},
|
||||
) else log.warn("unimplemented CSI callback: {}", .{action}),
|
||||
|
||||
// HPA - Cursor Horizontal Position Absolute
|
||||
// TODO: test
|
||||
'G', '`' => if (@hasDecl(T, "setCursorCol")) switch (action.params.len) {
|
||||
|
Reference in New Issue
Block a user