mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
cursor right
This commit is contained in:
@ -139,6 +139,16 @@ fn csiDispatch(
|
|||||||
action: Parser.Action.CSI,
|
action: Parser.Action.CSI,
|
||||||
) !void {
|
) !void {
|
||||||
switch (action.final) {
|
switch (action.final) {
|
||||||
|
// CUF - Cursor Right
|
||||||
|
'C' => self.cursorRight(switch (action.params.len) {
|
||||||
|
0 => 1,
|
||||||
|
1 => action.params[0],
|
||||||
|
else => {
|
||||||
|
log.warn("invalid cursor right command: {}", .{action});
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
|
||||||
// CUP - Set Cursor Position.
|
// CUP - Set Cursor Position.
|
||||||
'H' => {
|
'H' => {
|
||||||
switch (action.params.len) {
|
switch (action.params.len) {
|
||||||
@ -319,6 +329,21 @@ pub fn deleteChars(self: *Terminal, count: usize) !void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// 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
|
||||||
|
/// 0, adjust it to 1.
|
||||||
|
/// TODO: test
|
||||||
|
pub fn cursorRight(self: *Terminal, count: usize) void {
|
||||||
|
const tracy = trace(@src());
|
||||||
|
defer tracy.end();
|
||||||
|
|
||||||
|
self.cursor.x += count;
|
||||||
|
if (self.cursor.x == self.cols) {
|
||||||
|
self.cursor.x -= 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Backspace moves the cursor back a column (but not less than 0).
|
/// Backspace moves the cursor back a column (but not less than 0).
|
||||||
pub fn backspace(self: *Terminal) void {
|
pub fn backspace(self: *Terminal) void {
|
||||||
const tracy = trace(@src());
|
const tracy = trace(@src());
|
||||||
|
Reference in New Issue
Block a user