Merge pull request #212 from mitchellh/sgr

CSI for SGR only if there are no intermediates
This commit is contained in:
Mitchell Hashimoto
2023-07-20 19:31:31 -07:00
committed by GitHub

View File

@ -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