summaryrefslogtreecommitdiff
path: root/src/normal.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/normal.zig')
-rw-r--r--src/normal.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/normal.zig b/src/normal.zig
index f9d7cf25..f7ba3810 100644
--- a/src/normal.zig
+++ b/src/normal.zig
@@ -29,6 +29,7 @@ fn roleBindingName(comptime role: modal.Normal.Role) []const u8 {
return switch (role) {
.prefix_goto => "goto_prefix",
.prefix_view => "view_prefix",
+ .prefix_view_sticky => "view_prefix_sticky",
.prefix_match => "match_prefix",
.prefix_find_fwd => "find_char_fwd",
.prefix_find_back => "find_char_back",
@@ -478,6 +479,15 @@ fn executeNormalAction(p: *Pardes, t: *Text, semantic: modal.Normal.Action) void
pane.scrollBy(t.cur_row - (pane.scroll() + @as(i32, pane.rows) - 1));
pane.ensureCursorVisible();
},
+ .middle => {
+ // helix align_view_middle: the cursor's column to the middle
+ // of an unwrapped view
+ if (pane.body_wrapped) return;
+ const line = text[modal.lineStartOffset(text, modal.lineAtOffset(text, cur))..modal.lineEndOffset(text, modal.lineAtOffset(text, cur))];
+ const w: usize = @intCast(@max(1, @as(i32, pane.cols) - @as(i32, panes.File.gutterWidth(pane))));
+ const col = panes.File.rawDisplayCol(line, @intCast(@max(0, t.cur_col)));
+ pane.hscroll = @intCast(panes.File.rawAtDisplay(line, col -| w / 2));
+ },
.scroll_down => return t.scrollViewMove(text, range, 1),
.scroll_up => return t.scrollViewMove(text, range, -1),
},