mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-07-27 11:06:31 +00:00
terminal: respond to XTVERSION query
XTVERSION (CSI > 0 q) is used by some libraries to identify the terminal
+ version. Respond to this query with `ghostty {version_string}`. There
is no formal format for this response. A roundup of a few tested
terminals show two primary formats. This patch opts to save one byte and
use the `name SP version` semantics.
foot: foot(version)
xterm: XTerm(version)
contour: contour version
wezterm: wezterm version
Reference: https://github.com/dankamongmen/notcurses/blob/master/TERMINALS.md#notes-for-terminal-authors
Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
@@ -1688,6 +1688,23 @@ const StreamHandler = struct {
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user