Merge branch 'master' into zig-0.14

This commit is contained in:
CJ van den Berg 2025-02-19 21:36:09 +01:00
commit 90bacba8d5
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
4 changed files with 19 additions and 12 deletions

View file

@ -2084,21 +2084,25 @@ pub const Editor = struct {
}
fn move_cursor_up(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
try cursor.move_up(root, metrics);
cursor.move_up(root, metrics) catch |e| switch (e) {
error.Stop => cursor.move_begin(),
};
}
fn move_cursor_up_vim(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
try cursor.move_up(root, metrics);
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
if (is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
}
fn move_cursor_down(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
try cursor.move_down(root, metrics);
cursor.move_down(root, metrics) catch |e| switch (e) {
error.Stop => cursor.move_end(root, metrics),
};
}
fn move_cursor_down_vim(root: Buffer.Root, cursor: *Cursor, metrics: Buffer.Metrics) !void {
try cursor.move_down(root, metrics);
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
if (is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
}
fn move_cursor_buffer_begin(_: Buffer.Root, cursor: *Cursor, _: Buffer.Metrics) !void {
@ -2123,7 +2127,7 @@ pub const Editor = struct {
fn move_cursor_half_page_up_vim(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
cursor.move_half_page_up(root, view, metrics);
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
if (is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
}
fn move_cursor_half_page_down(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
@ -2132,7 +2136,7 @@ pub const Editor = struct {
fn move_cursor_half_page_down_vim(root: Buffer.Root, cursor: *Cursor, view: *const View, metrics: Buffer.Metrics) !void {
cursor.move_half_page_down(root, view, metrics);
if(is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
if (is_eol_vim(root, cursor, metrics)) try move_cursor_left_vim(root, cursor, metrics);
}
pub fn primary_click(self: *Self, y: c_int, x: c_int) !void {
@ -3481,7 +3485,7 @@ pub const Editor = struct {
for (self.cursels.items) |*cursel_| if (cursel_.*) |*cursel|
try self.select_line_around_cursor(cursel);
self.collapse_cursors();
self.clamp();
}
pub const select_line_vim_meta: Meta = .{ .description = "Select the line around the cursor (vim)" };