vaxis: implement bracketed paste

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>
This commit is contained in:
Tim Culverhouse 2024-01-24 13:23:02 -06:00
parent 400e2d5cac
commit 4c84faddfa
3 changed files with 16 additions and 1 deletions

View file

@ -19,7 +19,7 @@ Contributions are welcome.
| ------------------------------ | :---: | :------: | :-------: | | ------------------------------ | :---: | :------: | :-------: |
| RGB | ✅ | ✅ | ✅ | | RGB | ✅ | ✅ | ✅ |
| Hyperlinks | ✅ | planned | ❌ | | Hyperlinks | ✅ | planned | ❌ |
| Bracketed Paste | ✅ | planned | ❌ | | Bracketed Paste | ✅ | | ❌ |
| Kitty Keyboard | ✅ | ✅ | ✅ | | Kitty Keyboard | ✅ | ✅ | ✅ |
| Styled Underlines | ✅ | ✅ | ✅ | | Styled Underlines | ✅ | ✅ | ✅ |
| Mouse Shapes (OSC 22) | ✅ | planned | ❌ | | Mouse Shapes (OSC 22) | ✅ | planned | ❌ |

View file

@ -14,9 +14,14 @@ pub const sixel_geometry_query = "\x1b[?2;1;0S";
pub const sync_set = "\x1b[?2026h"; pub const sync_set = "\x1b[?2026h";
pub const sync_reset = "\x1b[?2026l"; pub const sync_reset = "\x1b[?2026l";
// unicode
pub const unicode_set = "\x1b[?2027h"; pub const unicode_set = "\x1b[?2027h";
pub const unicode_reset = "\x1b[?2027l"; pub const unicode_reset = "\x1b[?2027l";
// bracketed paste
pub const bp_set = "\x1b[?2004h";
pub const bp_reset = "\x1b[?2004l";
// Key encoding // Key encoding
pub const csi_u_push = "\x1b[>{d}u"; pub const csi_u_push = "\x1b[>{d}u";
pub const csi_u_pop = "\x1b[<u"; pub const csi_u_pop = "\x1b[<u";

View file

@ -500,6 +500,16 @@ pub fn Vaxis(comptime T: type) type {
.{title}, .{title},
); );
} }
// turn bracketed paste on or off. An event will be sent at the
// beginning and end of a detected paste. All keystrokes between these
// events were pasted
pub fn bracketedPaste(self: *Self, enable: bool) !void {
if (self.tty == null) return;
const seq = if (enable) ctlseqs.bp_set else ctlseqs.bp_reset;
_ = try self.tty.?.write(seq);
try self.tty.?.flush();
}
}; };
} }