summaryrefslogtreecommitdiff
path: root/src/keys.zig
diff options
context:
space:
mode:
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();