fix: make move_cursor_up/_down fallback to move_begin/_end

closes #185
This commit is contained in:
CJ van den Berg 2025-02-19 18:42:14 +01:00
parent fdabe03e91
commit c7cca545b9
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -2083,7 +2083,9 @@ 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 {
@ -2092,7 +2094,9 @@ pub const Editor = struct {
}
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 {