mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-21 11:16:08 +03:00
sgr pixels mouse report format
This commit is contained in:
@ -933,7 +933,19 @@ fn mouseReport(
|
||||
try self.queueWrite(resp);
|
||||
},
|
||||
|
||||
else => @panic("TODO"),
|
||||
.sgr_pixels => {
|
||||
// Response always is at least 4 chars, so this leaves the
|
||||
// remainder for numbers which are very large...
|
||||
var buf: [32]u8 = undefined;
|
||||
const resp = try std.fmt.bufPrint(&buf, "\x1B[<{d};{d};{d}{c}", .{
|
||||
button_code,
|
||||
pos.xpos,
|
||||
pos.ypos,
|
||||
@as(u8, if (action == .release) 'm' else 'M'),
|
||||
});
|
||||
|
||||
try self.queueWrite(resp);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@ -1513,6 +1525,7 @@ pub fn setMode(self: *Window, mode: terminal.Mode, enabled: bool) !void {
|
||||
.mouse_format_utf8 => self.terminal.modes.mouse_format = if (enabled) .utf8 else .x10,
|
||||
.mouse_format_sgr => self.terminal.modes.mouse_format = if (enabled) .sgr else .x10,
|
||||
.mouse_format_urxvt => self.terminal.modes.mouse_format = if (enabled) .urxvt else .x10,
|
||||
.mouse_format_sgr_pixels => self.terminal.modes.mouse_format = if (enabled) .sgr_pixels else .x10,
|
||||
|
||||
else => if (enabled) log.warn("unimplemented mode: {}", .{mode}),
|
||||
}
|
||||
|
@ -96,8 +96,6 @@ pub const MouseFormat = enum(u3) {
|
||||
utf8 = 1, // 1005
|
||||
sgr = 2, // 1006
|
||||
urxvt = 3, // 1015
|
||||
|
||||
// TODO:
|
||||
sgr_pixels = 4, // 1016
|
||||
};
|
||||
|
||||
|
@ -89,6 +89,9 @@ pub const Mode = enum(u16) {
|
||||
/// Report mouse position in the urxvt format.
|
||||
mouse_format_urxvt = 1015,
|
||||
|
||||
/// Report mouse position in the SGR format as pixels, instead of cells.
|
||||
mouse_format_sgr_pixels = 1016,
|
||||
|
||||
/// Alternate screen mode with save cursor and clear on enter.
|
||||
alt_screen_save_cursor_clear_enter = 1049,
|
||||
|
||||
|
Reference in New Issue
Block a user