diff options
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 70 |
1 files changed, 63 insertions, 7 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index f207ed9f..39a147fa 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -107,7 +107,7 @@ pub const OutputTraits = struct { name: []const u8, steps: bool = false, jumps: bool = false, - executes: bool = false, + commands: bool = false, }; /// The enum: field name = struct name, value = index into `all()`. Everything @@ -297,12 +297,13 @@ pub const Shell = struct { }; /// ...and the list of what Theme takes, as a buffer you walk. Its rows are -/// `Theme <name>` COMMANDS rather than locations, so n/N execute them instead -/// of looking them (output_pane.Traits.executes) and stepping the list wears -/// each theme in turn — the picker is the list, and there is nothing to -/// confirm because arriving already applied it. +/// `Theme <name>` COMMANDS rather than locations, which is one flag on the +/// buffer (output_pane.Traits.commands) and changes what a step SELECTS: the +/// whole line, since there is no path inside it to pick out. Tab on what n +/// selected wears that theme — the same middle click on the row is — so +/// walking the list with n/Tab is trying them on, and stopping is choosing. pub const ThemeSel = struct { - pub const output: OutputTraits = .{ .name = config.themes_buffer, .steps = true, .executes = true }; + pub const output: OutputTraits = .{ .name = config.themes_buffer, .steps = true, .commands = true }; pub fn run(c: Ctx) void { output_pane.openThemes(c.p, c.id) catch |err| c.p.reportError(c.id, "themes", err); } @@ -368,7 +369,7 @@ pub const Font = struct { /// unreadable one — and this picker EXECUTES what it steps onto, so listing /// them would mean the list wearing one on the way past. See fonts.monospaced. pub const FontSel = struct { - pub const output: OutputTraits = .{ .name = config.fonts_buffer, .steps = true, .executes = true }; + pub const output: OutputTraits = .{ .name = config.fonts_buffer, .steps = true, .commands = true }; pub const enabled = pardes.font_picker; pub fn run(c: Ctx) void { if (comptime enabled) apply(c) else unreachable; @@ -455,6 +456,61 @@ pub const Ascii = struct { } }; +// ---- the system clipboard ---- + +// helix's `<space>` clipboard menu, and the ONLY five words in pardes that +// touch the desktop's clipboard. Everything else — `y`, `d`, `c`, `p`, `P`, +// `R`, the acme cut/paste chords — lives entirely in the internal register, +// which is helix's arrangement and, less abstractly, the reason deleting a +// character no longer throws away whatever you had copied from a browser. +// +// They are builtins rather than bare chords because the leader table is the +// remapping surface and a leader path names a builtin: spelling them here +// puts them in Help's index, makes them executable words like every other +// verb, and costs no second mechanism. Their paths ARE helix's letters, on +// the same leader helix uses — see config.leader_path. +// +// The two directions are not symmetric, and cannot be. Writing is a fire-off: +// the core owns the bytes and the shell copies them out. READING has to leave +// the core and come back — SDL and NSPasteboard answer inside the same drain, +// a browser answers a promise later, and a terminal answers over OSC 52 or, +// far more often, refuses outright. So a paste is a REQUEST (the +// read_clipboard effect) that may simply never be answered, and a `SPC p` +// that does nothing in a locked-down terminal is the honest outcome rather +// than a bug to paper over with the internal register. + +pub const ClipYank = struct { + pub fn run(c: Ctx) void { + c.p.clipYank(c.pane, false); + } +}; + +/// helix `<space>Y`: the PRIMARY selection alone, where `SPC y` joins every +/// cursor's. One cursor makes them the same word. +pub const ClipYankMain = struct { + pub fn run(c: Ctx) void { + c.p.clipYank(c.pane, true); + } +}; + +pub const ClipPaste = struct { + pub fn run(c: Ctx) void { + c.p.clipRequest(c.id, .after); + } +}; + +pub const ClipPasteBefore = struct { + pub fn run(c: Ctx) void { + c.p.clipRequest(c.id, .before); + } +}; + +pub const ClipReplace = struct { + pub fn run(c: Ctx) void { + c.p.clipRequest(c.id, .replace); + } +}; + // ---- panes and columns ---- pub const Save = struct { |
