summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.zig19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/config.zig b/src/config.zig
index 86baa9fe..e9595a2a 100644
--- a/src/config.zig
+++ b/src/config.zig
@@ -57,7 +57,7 @@ pub const leader_path = paths: {
.Redo = null,
.Repl = null,
.Kill = null,
- .Exit = null,
+ .Exit = "q",
.ClipYank = "y",
.ClipYankMain = "Y",
.ClipPaste = "p",
@@ -193,7 +193,7 @@ pub const leader_path = paths: {
test "Space-k is unbound while Exit, Kill and other k chords remain available" {
try std.testing.expect(leader_path.get(.Kill) == null);
- try std.testing.expect(leader_path.get(.Exit) == null);
+ try std.testing.expectEqualStrings("q", leader_path.get(.Exit).?);
try std.testing.expectEqualStrings("wk", leader_path.get(.Up).?);
try std.testing.expectEqualStrings("lk", leader_path.get(.Hover).?);
try std.testing.expectEqualStrings("d", leader_path.get(.Del).?);
@@ -222,6 +222,21 @@ test "Space-k is unbound while Exit, Kill and other k chords remain available" {
try std.testing.expect(p.quit);
}
+test "SPC q runs Exit: refused once over unsaved text, as the tag word is, then it quits" {
+ const p = try pardes.Pardes.init(std.testing.allocator, .{ .tty_only = true });
+ defer p.deinit();
+ const pane = try p.setTestFile("text\n");
+ pane.file.?.saved_revision = pane.file.?.revision -% 1; // modified
+ pane.file.?.saved_hash = 0; // edited: what it had is not what it has
+ while (p.nextEffect()) |_| {}
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = 'q' } });
+ try std.testing.expect(!p.quit);
+ p.update(.{ .key = .{ .cp = ' ' } });
+ p.update(.{ .key = .{ .cp = 'q' } });
+ try std.testing.expect(p.quit);
+}
+
pub const look_key: []const Chord = &.{.{ .cp = Key.enter }};
pub const exec_key: []const Chord = &.{.{ .cp = Key.tab }};
pub const look_button: Mouse.Button = .right;