mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 00:36:07 +03:00
CSI for SGR only if there are no intermediates
Fixes #210 We were previously taking any `CSI <symbol> <data> m` as SGR. But SGR is only if "symbol" is empty. There are other forms of `CSI m` that set the intermediate symbol to `?` or `>` and we don't implement those. We shouldn't treat that as a SGR attribute either.
This commit is contained in:
@ -437,13 +437,22 @@ pub fn Stream(comptime Handler: type) type {
|
|||||||
} else log.warn("unimplemented CSI callback: {}", .{action}),
|
} else log.warn("unimplemented CSI callback: {}", .{action}),
|
||||||
|
|
||||||
// SGR - Select Graphic Rendition
|
// SGR - Select Graphic Rendition
|
||||||
'm' => if (@hasDecl(T, "setAttribute")) {
|
'm' => if (action.intermediates.len == 0) {
|
||||||
var p: sgr.Parser = .{ .params = action.params, .colon = action.sep == .colon };
|
if (@hasDecl(T, "setAttribute")) {
|
||||||
while (p.next()) |attr| {
|
var p: sgr.Parser = .{ .params = action.params, .colon = action.sep == .colon };
|
||||||
// log.info("SGR attribute: {}", .{attr});
|
while (p.next()) |attr| {
|
||||||
try self.handler.setAttribute(attr);
|
// log.info("SGR attribute: {}", .{attr});
|
||||||
}
|
try self.handler.setAttribute(attr);
|
||||||
} else log.warn("unimplemented CSI callback: {}", .{action}),
|
}
|
||||||
|
} else log.warn("unimplemented CSI callback: {}", .{action});
|
||||||
|
} else {
|
||||||
|
// Nothing, but I wanted a place to put this comment:
|
||||||
|
// there are others forms of CSI m that have intermediates.
|
||||||
|
// `vim --clean` uses `CSI ? 4 m` and I don't know what
|
||||||
|
// that means. And there is also `CSI > m` which is used
|
||||||
|
// to control modifier key reporting formats that we don't
|
||||||
|
// support yet.
|
||||||
|
},
|
||||||
|
|
||||||
// CPR - Request Cursor Postion Report
|
// CPR - Request Cursor Postion Report
|
||||||
// TODO: test
|
// TODO: test
|
||||||
|
Reference in New Issue
Block a user