diff options
| author | Gabriel Schneider <[email protected]> | 2026-07-08 12:25:04 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-08-01 15:02:07 -0300 |
| commit | 172eb56fee0b6bde698e72be2bca55a90fe81ce9 (patch) | |
| tree | f2fd94709facf134c3670db4c1a20a5eaca1d53d /src/pardes.zig | |
| parent | b91e5ebf8b529d0ced0bf18e83b17df0bd2374ce (diff) | |
| download | pardes-172eb56fee0b6bde698e72be2bca55a90fe81ce9.tar.gz pardes-172eb56fee0b6bde698e72be2bca55a90fe81ce9.zip | |
steam deck nice version
Diffstat (limited to 'src/pardes.zig')
| -rw-r--r-- | src/pardes.zig | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/src/pardes.zig b/src/pardes.zig index 994b0785..f6c0a09c 100644 --- a/src/pardes.zig +++ b/src/pardes.zig @@ -36,7 +36,7 @@ pub const PREFIX_W: u16 = 5; /// above/below the cursor (clamped at file boundaries and short panes) const scroll_off = 3; -pub const topbar_str = "Kill Newcol Tutor Debug Colors NextColor Dump"; +pub const topbar_str = "Kill Newcol Tutor Debug Colors NextColor Crt Dump"; const pane_builtins_str = "Del"; const file_pane_builtins_str = "Save Del"; const pane_tail = " " ++ pane_builtins_str; @@ -44,7 +44,7 @@ const file_pane_tail = " " ++ file_pane_builtins_str; // Builtins: executing the name (middle-click / Tab) runs the action through the // ONE dispatcher (onSelect + actOnSelection), no matter where the name appears. -const SelectAction = enum { none, send, newcol, delcol, del, save, tutor, kill, debug, colors, nextcolor, dump, restore }; +const SelectAction = enum { none, send, newcol, delcol, del, save, tutor, kill, debug, colors, nextcolor, crt, dump, restore }; const Builtin = struct { name: []const u8, action: SelectAction }; const builtins = [_]Builtin{ .{ .name = "Kill", .action = .kill }, @@ -53,6 +53,7 @@ const builtins = [_]Builtin{ .{ .name = "Debug", .action = .debug }, .{ .name = "Colors", .action = .colors }, .{ .name = "NextColor", .action = .nextcolor }, + .{ .name = "Crt", .action = .crt }, .{ .name = "Dump", .action = .dump }, .{ .name = "Restore", .action = .restore }, .{ .name = "Save", .action = .save }, @@ -355,9 +356,6 @@ pub const Effect = union(enum) { write_dump, /// the yank register changed; the shell reads it off the core (OSC 52 out) set_clipboard, - /// a normal-mode `p` wants the system clipboard; the shell requests it and - /// the reply comes back as Event.paste - get_clipboard, quit, fn Buf(comptime n: usize) type { @@ -709,6 +707,9 @@ pub const Pardes = struct { theme_idx: usize = 0, colors_on: bool = true, show_debug: bool = false, + /// the Crt builtin's CRT post-process, rendered by the gui shell only + /// (the tty and web shells never read it) + crt_on: bool = false, /// kitty graphics support, reported by the shell (image panes fall back /// to the petscii matcher without it) kitty_ok: bool = false, @@ -732,9 +733,6 @@ pub const Pardes = struct { /// modal yank register (gpa-owned); a yank also mirrors out to the system /// clipboard via the set_clipboard effect. yank: ?[]u8 = null, - /// a normal-mode `P` is in flight: the next Event.paste pastes BEFORE - /// (the get_clipboard round trip carries no argument) - paste_before: bool = false, /// the last serialized dump (gpa-owned), read by the write_dump effect dump_out: ?[]u8 = null, /// where the shell wrote the last dump (shell reports back after @@ -971,10 +969,9 @@ pub const Pardes = struct { .key => |key| p.handleKey(key), .mouse => |m| p.handleMouse(m), .paste => |bytes| { - // the OSC 52 system-clipboard reply for a normal-mode `p`/`P` + // a shell-level paste (bracketed/SDL): load the register, paste p.setYank(bytes); - if (p.panes[p.active]) |pane| p.normalPaste(pane, p.paste_before); - p.paste_before = false; + if (p.panes[p.active]) |pane| p.normalPaste(pane, false); }, .pinch => |scale| p.ov_pinch_scale = scale, .touch_scroll => |delta| p.ov_touch_scroll_delta = delta, @@ -1285,13 +1282,13 @@ pub const Pardes = struct { p.tagInsertKey(pane, key); return; } - // normal-mode `p`/`P` paste the SYSTEM clipboard: an async OSC 52 - // round trip — request here, the reply arrives later as Event.paste. + // normal-mode `p`/`P` paste the core's yank register directly (helix: + // the default register, NOT the system clipboard — most terminals + // refuse the OSC 52 read, so a round trip would never come back). // Skipped while a prefix waits for its char argument (f/r/m and // friends take `p` literally). if (pane.mode == .normal and pane.pending == 0 and (is(key, 'p') or is(key, 'P'))) { - p.paste_before = is(key, 'P'); - p.emit(.get_clipboard); + p.normalPaste(pane, is(key, 'P')); return; } switch (pane.mode) { @@ -4350,6 +4347,7 @@ pub const Pardes = struct { .debug => p.show_debug = !p.show_debug, .colors => p.colors_on = !p.colors_on, .nextcolor => p.theme_idx = (p.theme_idx + 1) % themes.len, + .crt => p.crt_on = !p.crt_on, .dump => p.dumpState() catch {}, .restore => { var it = std.mem.tokenizeAny(u8, std.mem.trim(u8, txt, " \t\r\n"), " \t"); |
