summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pardes.zig18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/pardes.zig b/src/pardes.zig
index b7cf5574..3194b059 100644
--- a/src/pardes.zig
+++ b/src/pardes.zig
@@ -2911,6 +2911,19 @@ test "a header's execute key runs the word under its cursor and lets go of the k
try std.testing.expectEqual(@as(usize, 1), p.col_n[0]);
}
+test "Enter in a header runs the word under its cursor, as the execute key does" {
+ const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 12, .tty_only = true });
+ defer p.deinit();
+ _ = try p.setTestFile("body\n");
+ try std.testing.expectEqual(@as(usize, 1), p.ncol);
+ tagline.enterHeader(p, null);
+ p.global_tag.cur_col = @intCast(std.mem.indexOf(u8, config.topbar_str, "Newcol").?);
+ p.update(.{ .key = .{ .cp = Key.enter } });
+ try std.testing.expectEqual(@as(usize, 2), p.ncol);
+ // and the header lets go of the keyboard, as a pane tag does
+ try std.testing.expect(!p.header_focus);
+}
+
test "window keys walk from a pane up through the column and workspace tags and back" {
const p = try Pardes.init(std.testing.allocator, .{ .cols = 100, .rows = 20, .tty_only = true });
defer p.deinit();
@@ -4933,7 +4946,10 @@ pub const Pardes = struct {
return;
}
if (t.mode == .normal and (hit(key, config.look_key) or hit(key, config.exec_key))) {
- const cmd = if (hit(key, config.look_key)) config.look_cmd else config.exec_cmd;
+ // A header's words are the workspace's and column's commands, so
+ // Enter runs them there, as the execute key does.
+ const header_word = t.what == .column or t.what == .workspace;
+ const cmd = if (hit(key, config.look_key) and !header_word) config.look_cmd else config.exec_cmd;
if (t.what != .body) {
// An explicit selection, else the word under the cursor in the
// text as it is shown: a tag's prefix is part of what a word is.