summaryrefslogtreecommitdiff
path: root/src/keys.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-05 23:27:29 -0300
committerGabriel Schneider <[email protected]>2026-11-05 23:58:31 -0300
commitcd3627307740896426830423598d2e1a8e27b024 (patch)
tree8cb845c8da5d07c15d9d234f285bff9cffb83449 /src/keys.zig
parent342650183a54dcfcdce6ca4d45d6fdf48b2d1c1c (diff)
downloadpardes-cd3627307740896426830423598d2e1a8e27b024.tar.gz
pardes-cd3627307740896426830423598d2e1a8e27b024.zip
settings #5, three behaviour knobs go, each the value it had by default: ProgramEsc (in a raw terminal Esc goes back a pane and Shift-Esc is the program's Esc; keys.zig's at-the-prompt Esc, which only ProgramEsc reached, goes), JumpScope (Back and Forward keep to the focused pane's file first; Jump.jumpBy's scope test goes) and WindowBlur (the macOS window draws no blur: macos.zig's pardes_window_blur, its header line, and AppDelegate.swift's NSVisualEffectView backdrop go, built nowhere here; Capabilities.window_blur with them); deleted tests: "with ProgramEsc raw tty Escape only leaves at a shell prompt", "modes: with JumpScope all, Ctrl-o and Ctrl-i take every place in the order it was jumped to, and bare JumpScope is file again", "window blur defaults off and validates without changing opacity", macos.zig's "mac window blur builtin reaches the ABI without changing opacity", and the JumpScope all half of "settings: Back and Forward written to exec keep to the focused file"; rewritten: dump's settings test on Wrap, the PDF jump test without its scope check, other-files' jump to a closed file from the +Jumps listing (no file to keep to); the reference, guide, helix-keys and macos docs lose the three; no golden changes; gates on tui: core-test 961/961, behaviour-test 240/240, unit-test 1476/1477, pane-test 171/172, snap all 105 scripts ok, process-test 0 of 37 failed; gui unit-test 1520/1521
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/keys.zig')
-rw-r--r--src/keys.zig41
1 files changed, 3 insertions, 38 deletions
diff --git a/src/keys.zig b/src/keys.zig
index 9f16b42a..9496d37a 100644
--- a/src/keys.zig
+++ b/src/keys.zig
@@ -169,9 +169,9 @@ pub fn handleKey(p: *Pardes, key: Key) void {
if (p.window_pick != null) return layout.windowKey(p, key);
const pane = p.panes[p.active] orelse return;
layout.noteTyped(p);
- // In a raw terminal the two Escs swap unless ProgramEsc is on: Esc
- // backs out, and Shift-Esc is the program's, sent as a plain Esc.
- const raw_esc = key.cp == Key.escape and !key.ctrl and !key.alt and !p.settings.program_esc and
+ // In a raw terminal the two Escs swap: Esc backs out, and Shift-Esc is
+ // the program's, sent as a plain Esc.
+ const raw_esc = key.cp == Key.escape and !key.ctrl and !key.alt and
pane.isTerminal() and pane.body.mode == .tty and pane.focus == .body and pane.prompt == .none and
tagline.focusedHeader(p) == null;
if (raw_esc and key.shift) {
@@ -210,10 +210,6 @@ pub fn handleKey(p: *Pardes, key: Key) void {
p.prefix = .none;
if (key.ctrl and !key.alt and key.cp == p.tty_toggle)
return toggleTty(p, p.active);
- // With ProgramEsc on, bare Escape leaves only at a shell prompt
- // (Shift-Esc, above, always).
- if (key.cp == Key.escape and !key.ctrl and !key.alt and !key.shift and exec.takesCommandLine(p, p.active))
- return exec.runBuiltin(p, .Last, p.active, "", null);
panes.terminal.followOutput(pane); // typing snaps back to live output
// Paste stays the window's, the one exception to forwarding a raw
// tty's keys: Ctrl-V types the register at the program and
@@ -642,37 +638,6 @@ test "raw tty Esc backs out and Shift-Esc is the program's Esc" {
try std.testing.expectEqualStrings("\x1b", test_api.ptyBytes(p, null, &buf));
}
-test "with ProgramEsc raw tty Escape only leaves at a shell prompt" {
- const p = try Pardes.init(std.testing.allocator, .{ .cols = 80, .rows = 24, .file = "mise.toml" });
- defer p.deinit();
- p.settings.program_esc = true;
- _ = exec.spawnTty(p, 0);
- const shell = p.active;
- const pane = p.panes[shell].?;
- var buf: [256]u8 = undefined;
- _ = test_api.ptyBytes(p, null, &buf);
-
- // Ordinary keys reach the child; Shift-Escape is the one unconditional way
- // out and sends it nothing.
- p.update(.{ .key = .{ .cp = 'x', .text = "x" } });
- try std.testing.expectEqual(shell, p.active);
- try std.testing.expect(test_api.ptyBytes(p, null, &buf).len > 0);
-
- p.update(.{ .key = .{ .cp = Key.escape, .shift = true } });
- try std.testing.expectEqual(@as(usize, 0), p.active);
- try std.testing.expectEqualStrings("", test_api.ptyBytes(p, null, &buf));
- try std.testing.expectEqual(Text.Mode.tty, pane.body.mode);
-
- p.update(.{ .key = .{ .cp = Key.escape } }); // back into the shell
- try std.testing.expectEqual(shell, p.active);
- _ = test_api.ptyBytes(p, null, &buf);
-
- p.update(.{ .key = .{ .cp = Key.escape } }); // bare Escape leaves at a prompt
- try std.testing.expectEqual(@as(usize, 0), p.active);
- try std.testing.expectEqualStrings("", test_api.ptyBytes(p, null, &buf));
- try std.testing.expectEqual(Text.Mode.tty, pane.body.mode);
-}
-
test "the Del question shows only once its delay is up: a quick SPC d j never sees it" {
const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 40 });
defer p.deinit();