Compare commits
3 commits
16377e3700
...
5d7323bfe7
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d7323bfe7 | ||
|
|
00abd90cd5 | ||
|
|
5871583cba |
2 changed files with 32 additions and 16 deletions
|
|
@ -180,8 +180,8 @@
|
|||
["alt+[", "select_prev_sibling", true],
|
||||
["alt+]", "select_next_sibling", true],
|
||||
["alt+a", "select_all_siblings"],
|
||||
["alt+shift+home", "move_scroll_left"],
|
||||
["alt+shift+end", "move_scroll_right"],
|
||||
["alt+shift+home", "scroll_left"],
|
||||
["alt+shift+end", "scroll_right"],
|
||||
["alt+shift+up", "add_cursor_up"],
|
||||
["alt+shift+down", "add_cursor_down"],
|
||||
["alt+shift+f12", "goto_type_definition"],
|
||||
|
|
|
|||
|
|
@ -3007,17 +3007,15 @@ pub const Editor = struct {
|
|||
self.update_animation_step(dest);
|
||||
}
|
||||
|
||||
fn scroll_up(self: *Self) void {
|
||||
const scroll_step_vertical = tui.config().scroll_step_vertical;
|
||||
fn scroll_up_internal(self: *Self, count: usize) void {
|
||||
var dest_row = self.scroll_dest;
|
||||
dest_row = if (dest_row > scroll_step_vertical) dest_row - scroll_step_vertical else 0;
|
||||
dest_row -|= count;
|
||||
self.update_scroll_dest_abs(dest_row);
|
||||
}
|
||||
|
||||
fn scroll_down(self: *Self) void {
|
||||
const scroll_step_vertical = tui.config().scroll_step_vertical;
|
||||
fn scroll_down_internal(self: *Self, count: usize) void {
|
||||
var dest_row = self.scroll_dest;
|
||||
dest_row += scroll_step_vertical;
|
||||
dest_row += count;
|
||||
self.update_scroll_dest_abs(dest_row);
|
||||
}
|
||||
|
||||
|
|
@ -3040,7 +3038,7 @@ pub const Editor = struct {
|
|||
else if (tui.fast_scroll())
|
||||
self.scroll_pageup()
|
||||
else
|
||||
self.scroll_up();
|
||||
self.scroll_up_internal(tui.config().scroll_step_vertical);
|
||||
}
|
||||
|
||||
pub fn mouse_scroll_down(self: *Self) void {
|
||||
|
|
@ -3049,7 +3047,7 @@ pub const Editor = struct {
|
|||
else if (tui.fast_scroll())
|
||||
self.scroll_pagedown()
|
||||
else
|
||||
self.scroll_down();
|
||||
self.scroll_down_internal(tui.config().scroll_step_vertical);
|
||||
}
|
||||
|
||||
pub fn scroll_to(self: *Self, row: usize) void {
|
||||
|
|
@ -4542,6 +4540,20 @@ pub const Editor = struct {
|
|||
}
|
||||
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 {
|
||||
const root = try self.buf_root();
|
||||
self.with_cursors_const_repeat(root, move_cursor_up, ctx) catch {};
|
||||
|
|
@ -4558,15 +4570,19 @@ pub const Editor = struct {
|
|||
}
|
||||
pub const move_scroll_down_meta: Meta = .{ .description = "Move and scroll down", .arguments = &.{.integer} };
|
||||
|
||||
pub fn move_scroll_left(self: *Self, _: Context) Result {
|
||||
self.view.move_left(tui.config().scroll_step_horizontal) catch {};
|
||||
pub fn scroll_left(self: *Self, ctx: Context) Result {
|
||||
var count: usize = 1;
|
||||
_ = ctx.args.match(.{tp.extract(&count)}) catch false;
|
||||
self.view.move_left(count) catch {};
|
||||
}
|
||||
pub const move_scroll_left_meta: Meta = .{ .description = "Scroll left" };
|
||||
pub const scroll_left_meta: Meta = .{ .description = "Scroll left", .arguments = &.{.integer} };
|
||||
|
||||
pub fn move_scroll_right(self: *Self, _: Context) Result {
|
||||
self.view.move_right(tui.config().scroll_step_horizontal) catch {};
|
||||
pub fn scroll_right(self: *Self, ctx: Context) Result {
|
||||
var count: usize = 1;
|
||||
_ = ctx.args.match(.{tp.extract(&count)}) catch false;
|
||||
self.view.move_right(count) catch {};
|
||||
}
|
||||
pub const move_scroll_right_meta: Meta = .{ .description = "Scroll right" };
|
||||
pub const scroll_right_meta: Meta = .{ .description = "Scroll right", .arguments = &.{.integer} };
|
||||
|
||||
pub fn mouse_scroll_left(self: *Self) void {
|
||||
const scroll_step_horizontal = tui.config().scroll_step_horizontal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue