mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 15:56:13 +03:00
plumb CSI to set cursor style, but haven't implemented any styles
This commit is contained in:
@ -669,3 +669,14 @@ pub fn deviceStatusReport(
|
|||||||
else => log.warn("unimplemented device status req: {}", .{req}),
|
else => log.warn("unimplemented device status req: {}", .{req}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn setCursorStyle(
|
||||||
|
self: *Window,
|
||||||
|
style: terminal.CursorStyle,
|
||||||
|
) !void {
|
||||||
|
_ = self;
|
||||||
|
|
||||||
|
switch (style) {
|
||||||
|
else => log.warn("unimplemented cursor style: {}", .{style}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -58,3 +58,17 @@ pub const DeviceStatusReq = enum(u16) {
|
|||||||
// Non-exhaustive so that @intToEnum never fails for unsupported modes.
|
// Non-exhaustive so that @intToEnum never fails for unsupported modes.
|
||||||
_,
|
_,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Possible cursor styles (ESC [ q)
|
||||||
|
pub const CursorStyle = enum(u16) {
|
||||||
|
default = 0,
|
||||||
|
blinking_block = 1,
|
||||||
|
steady_block = 2,
|
||||||
|
blinking_underline = 3,
|
||||||
|
steady_underline = 4,
|
||||||
|
blinking_bar = 5,
|
||||||
|
steady_bar = 6,
|
||||||
|
|
||||||
|
// Non-exhaustive so that @intToEnum never fails for unsupported modes.
|
||||||
|
_,
|
||||||
|
};
|
||||||
|
@ -7,6 +7,7 @@ pub const color = @import("color.zig");
|
|||||||
pub const Terminal = @import("Terminal.zig");
|
pub const Terminal = @import("Terminal.zig");
|
||||||
pub const Parser = @import("Parser.zig");
|
pub const Parser = @import("Parser.zig");
|
||||||
pub const Stream = stream.Stream;
|
pub const Stream = stream.Stream;
|
||||||
|
pub const CursorStyle = ansi.CursorStyle;
|
||||||
pub const DeviceAttributeReq = ansi.DeviceAttributeReq;
|
pub const DeviceAttributeReq = ansi.DeviceAttributeReq;
|
||||||
pub const DeviceStatusReq = ansi.DeviceStatusReq;
|
pub const DeviceStatusReq = ansi.DeviceStatusReq;
|
||||||
pub const Mode = ansi.Mode;
|
pub const Mode = ansi.Mode;
|
||||||
|
@ -307,6 +307,19 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
},
|
},
|
||||||
) else log.warn("unimplemented CSI callback: {}", .{action}),
|
) else log.warn("unimplemented CSI callback: {}", .{action}),
|
||||||
|
|
||||||
|
// DECSCUSR - Select Cursor Style
|
||||||
|
// TODO: test
|
||||||
|
'q' => if (@hasDecl(T, "setCursorStyle")) try self.handler.setCursorStyle(
|
||||||
|
switch (action.params.len) {
|
||||||
|
0 => ansi.CursorStyle.default,
|
||||||
|
1 => @intToEnum(ansi.CursorStyle, action.params[0]),
|
||||||
|
else => {
|
||||||
|
log.warn("invalid set curor style command: {}", .{action});
|
||||||
|
return;
|
||||||
|
},
|
||||||
|
},
|
||||||
|
) else log.warn("unimplemented CSI callback: {}", .{action}),
|
||||||
|
|
||||||
// DECSTBM - Set Top and Bottom Margins
|
// DECSTBM - Set Top and Bottom Margins
|
||||||
// TODO: test
|
// TODO: test
|
||||||
'r' => if (@hasDecl(T, "setTopAndBottomMargin")) switch (action.params.len) {
|
'r' => if (@hasDecl(T, "setTopAndBottomMargin")) switch (action.params.len) {
|
||||||
|
Reference in New Issue
Block a user