mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
Merge pull request #502 from rockorager/xtversion
terminal: respond to XTVERSION query
This commit is contained in:
@ -607,18 +607,11 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
),
|
),
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'q' => switch (action.intermediates.len) {
|
||||||
|
1 => switch (action.intermediates[0]) {
|
||||||
// DECSCUSR - Select Cursor Style
|
// DECSCUSR - Select Cursor Style
|
||||||
// TODO: test
|
// TODO: test
|
||||||
'q' => switch (action.intermediates.len) {
|
' ' => {
|
||||||
1 => cursor: {
|
|
||||||
if (action.intermediates[0] != ' ') {
|
|
||||||
log.warn(
|
|
||||||
"ignoring unimplemented CSI q with intermediates: {s}",
|
|
||||||
.{action.intermediates},
|
|
||||||
);
|
|
||||||
break :cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (@hasDecl(T, "setCursorStyle")) try self.handler.setCursorStyle(
|
if (@hasDecl(T, "setCursorStyle")) try self.handler.setCursorStyle(
|
||||||
switch (action.params.len) {
|
switch (action.params.len) {
|
||||||
0 => ansi.CursorStyle.default,
|
0 => ansi.CursorStyle.default,
|
||||||
@ -630,6 +623,17 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
},
|
},
|
||||||
) else log.warn("unimplemented CSI callback: {}", .{action});
|
) else log.warn("unimplemented CSI callback: {}", .{action});
|
||||||
},
|
},
|
||||||
|
// XTVERSION
|
||||||
|
'>' => {
|
||||||
|
if (@hasDecl(T, "reportXtversion")) try self.handler.reportXtversion();
|
||||||
|
},
|
||||||
|
else => {
|
||||||
|
log.warn(
|
||||||
|
"ignoring unimplemented CSI q with intermediates: {s}",
|
||||||
|
.{action.intermediates},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
else => log.warn(
|
else => log.warn(
|
||||||
"ignoring unimplemented CSI p with intermediates: {s}",
|
"ignoring unimplemented CSI p with intermediates: {s}",
|
||||||
|
@ -1688,6 +1688,23 @@ const StreamHandler = struct {
|
|||||||
self.terminal.screen.kitty_keyboard.set(mode, flags);
|
self.terminal.screen.kitty_keyboard.set(mode, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn reportXtversion(
|
||||||
|
self: *StreamHandler,
|
||||||
|
) !void {
|
||||||
|
log.debug("reporting XTVERSION: ghostty {s}", .{build_config.version_string});
|
||||||
|
var msg: termio.Message = .{ .write_small = .{} };
|
||||||
|
const resp = try std.fmt.bufPrint(
|
||||||
|
&msg.write_small.data,
|
||||||
|
"\x1BP>|{s} {s}\x07",
|
||||||
|
.{
|
||||||
|
"ghostty",
|
||||||
|
build_config.version_string,
|
||||||
|
},
|
||||||
|
);
|
||||||
|
msg.write_small.len = @intCast(resp.len);
|
||||||
|
self.messageWriter(msg);
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// OSC
|
// OSC
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user