diff options
Diffstat (limited to 'build/patches/vaxis_parser.zig')
| -rw-r--r-- | build/patches/vaxis_parser.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/build/patches/vaxis_parser.zig b/build/patches/vaxis_parser.zig new file mode 100644 index 00000000..90b09025 --- /dev/null +++ b/build/patches/vaxis_parser.zig @@ -0,0 +1,13 @@ +/// pardes's patch (its build.zig): whether `CSI ... R` answers a cursor +/// position query. Only `CSI 1 ; mods R` with mods past 1 is a modified F3 +/// (a bare F3 is `SS3 R`); a report has another row, or col 1 (mods 1). +fn cursorReport(sequence: []const u8) bool { + const params = sequence[2 .. sequence.len - 1]; + if (params.len > 0 and params[0] == '?') return true; + var fields = std.mem.splitScalar(u8, params, ';'); + const row = fields.first(); + const col = fields.next() orelse return false; + if (fields.next() != null or row.len == 0 or col.len == 0) return false; + for (params) |c| if (c != ';' and !std.ascii.isDigit(c)) return false; + return !std.mem.eql(u8, row, "1") or std.mem.eql(u8, col, "1"); +} |
