Compare commits

..

No commits in common. "5d7323bfe71a35874e795c0041de3f06078e5f80" and "16377e37005624cd3186f57a7c78272300612886" have entirely different histories.

2 changed files with 16 additions and 32 deletions

View file

@ -180,8 +180,8 @@
["alt+[", "select_prev_sibling", true], ["alt+[", "select_prev_sibling", true],
["alt+]", "select_next_sibling", true], ["alt+]", "select_next_sibling", true],
["alt+a", "select_all_siblings"], ["alt+a", "select_all_siblings"],
["alt+shift+home", "scroll_left"], ["alt+shift+home", "move_scroll_left"],
["alt+shift+end", "scroll_right"], ["alt+shift+end", "move_scroll_right"],
["alt+shift+up", "add_cursor_up"], ["alt+shift+up", "add_cursor_up"],
["alt+shift+down", "add_cursor_down"], ["alt+shift+down", "add_cursor_down"],
["alt+shift+f12", "goto_type_definition"], ["alt+shift+f12", "goto_type_definition"],

View file

@ -3007,15 +3007,17 @@ pub const Editor = struct {
self.update_animation_step(dest); self.update_animation_step(dest);
} }
fn scroll_up_internal(self: *Self, count: usize) void { fn scroll_up(self: *Self) void {
const scroll_step_vertical = tui.config().scroll_step_vertical;
var dest_row = self.scroll_dest; var dest_row = self.scroll_dest;
dest_row -|= count; dest_row = if (dest_row > scroll_step_vertical) dest_row - scroll_step_vertical else 0;
self.update_scroll_dest_abs(dest_row); self.update_scroll_dest_abs(dest_row);
} }
fn scroll_down_internal(self: *Self, count: usize) void { fn scroll_down(self: *Self) void {
const scroll_step_vertical = tui.config().scroll_step_vertical;
var dest_row = self.scroll_dest; var dest_row = self.scroll_dest;
dest_row += count; dest_row += scroll_step_vertical;
self.update_scroll_dest_abs(dest_row); self.update_scroll_dest_abs(dest_row);
} }
@ -3038,7 +3040,7 @@ pub const Editor = struct {
else if (tui.fast_scroll()) else if (tui.fast_scroll())
self.scroll_pageup() self.scroll_pageup()
else else
self.scroll_up_internal(tui.config().scroll_step_vertical); self.scroll_up();
} }
pub fn mouse_scroll_down(self: *Self) void { pub fn mouse_scroll_down(self: *Self) void {
@ -3047,7 +3049,7 @@ pub const Editor = struct {
else if (tui.fast_scroll()) else if (tui.fast_scroll())
self.scroll_pagedown() self.scroll_pagedown()
else else
self.scroll_down_internal(tui.config().scroll_step_vertical); self.scroll_down();
} }
pub fn scroll_to(self: *Self, row: usize) void { pub fn scroll_to(self: *Self, row: usize) void {
@ -4540,20 +4542,6 @@ pub const Editor = struct {
} }
pub const unindent_meta: Meta = .{ .description = "Unindent current line", .arguments = &.{.integer} }; pub const unindent_meta: Meta = .{ .description = "Unindent current line", .arguments = &.{.integer} };
pub fn scroll_up(self: *Self, ctx: Context) Result {
var count: usize = 1;
_ = ctx.args.match(.{tp.extract(&count)}) catch false;
self.scroll_up_internal(count);
}
pub const scroll_up_meta: Meta = .{ .description = "Scroll up", .arguments = &.{.integer} };
pub fn scroll_down(self: *Self, ctx: Context) Result {
var count: usize = 1;
_ = ctx.args.match(.{tp.extract(&count)}) catch false;
self.scroll_down_internal(count);
}
pub const scroll_down_meta: Meta = .{ .description = "Scroll down", .arguments = &.{.integer} };
pub fn move_scroll_up(self: *Self, ctx: Context) Result { pub fn move_scroll_up(self: *Self, ctx: Context) Result {
const root = try self.buf_root(); const root = try self.buf_root();
self.with_cursors_const_repeat(root, move_cursor_up, ctx) catch {}; self.with_cursors_const_repeat(root, move_cursor_up, ctx) catch {};
@ -4570,19 +4558,15 @@ pub const Editor = struct {
} }
pub const move_scroll_down_meta: Meta = .{ .description = "Move and scroll down", .arguments = &.{.integer} }; pub const move_scroll_down_meta: Meta = .{ .description = "Move and scroll down", .arguments = &.{.integer} };
pub fn scroll_left(self: *Self, ctx: Context) Result { pub fn move_scroll_left(self: *Self, _: Context) Result {
var count: usize = 1; self.view.move_left(tui.config().scroll_step_horizontal) catch {};
_ = ctx.args.match(.{tp.extract(&count)}) catch false;
self.view.move_left(count) catch {};
} }
pub const scroll_left_meta: Meta = .{ .description = "Scroll left", .arguments = &.{.integer} }; pub const move_scroll_left_meta: Meta = .{ .description = "Scroll left" };
pub fn scroll_right(self: *Self, ctx: Context) Result { pub fn move_scroll_right(self: *Self, _: Context) Result {
var count: usize = 1; self.view.move_right(tui.config().scroll_step_horizontal) catch {};
_ = ctx.args.match(.{tp.extract(&count)}) catch false;
self.view.move_right(count) catch {};
} }
pub const scroll_right_meta: Meta = .{ .description = "Scroll right", .arguments = &.{.integer} }; pub const move_scroll_right_meta: Meta = .{ .description = "Scroll right" };
pub fn mouse_scroll_left(self: *Self) void { pub fn mouse_scroll_left(self: *Self) void {
const scroll_step_horizontal = tui.config().scroll_step_horizontal; const scroll_step_horizontal = tui.config().scroll_step_horizontal;