From 4315121885bebd48f8c03a2b1c7b0bd943c67afd Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Mon, 28 Sep 2026 15:31:55 -0300 Subject: Alt-J joins lines and selects the spaces it put in helix-golf's text_into_array turns lines into an array with %ms"i,: join_selections_space joins like J and leaves one cursor on each space it inserted. J and Alt-J now make one edit over every range, as helix does, rather than J being replayed per range; that is what lets Alt-J hand back all the spaces as the new selection. Co-Authored-By: Claude Opus 5.5 --- src/modal.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/modal.zig') diff --git a/src/modal.zig b/src/modal.zig index 3827d11f..0e6aba61 100644 --- a/src/modal.zig +++ b/src/modal.zig @@ -108,6 +108,7 @@ pub const Normal = struct { to_lowercase, to_uppercase, join_lines, + join_select_space, indent, unindent, format, @@ -260,6 +261,7 @@ pub const Normal = struct { lowercase, uppercase, join_lines, + join_select_space, indent, unindent, comment_toggle, @@ -317,7 +319,7 @@ pub const Normal = struct { .search_step, => .once, .edit => |edit| switch (edit.kind) { - .comment_toggle, .undo, .redo => .once, + .join_lines, .join_select_space, .comment_toggle, .undo, .redo => .once, else => .per_selection, }, else => .per_selection, @@ -549,6 +551,7 @@ pub const Normal = struct { if (key.has(.to_lowercase)) return resultAction(.{ .edit = .{ .kind = .lowercase, .count = count } }); if (key.has(.to_uppercase)) return resultAction(.{ .edit = .{ .kind = .uppercase, .count = count } }); if (key.has(.join_lines)) return resultAction(.{ .edit = .{ .kind = .join_lines, .count = count } }); + if (key.has(.join_select_space)) return resultAction(.{ .edit = .{ .kind = .join_select_space, .count = count } }); if (key.has(.indent)) return resultAction(.{ .edit = .{ .kind = .indent, .count = count } }); if (key.has(.unindent)) return resultAction(.{ .edit = .{ .kind = .unindent, .count = count } }); if (key.has(.format)) return resultAction(.{ .lsp = .format }); -- cgit v1.3