input: scroll_to_row action
parent
135136f733
commit
c86266cd90
|
|
@ -4827,12 +4827,27 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||
}, .unlocked);
|
||||
},
|
||||
|
||||
.scroll_to_row => |n| {
|
||||
{
|
||||
self.renderer_state.mutex.lock();
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
const t: *terminal.Terminal = self.renderer_state.terminal;
|
||||
t.screen.scroll(.{ .row = n });
|
||||
}
|
||||
|
||||
try self.queueRender();
|
||||
},
|
||||
|
||||
.scroll_to_selection => {
|
||||
self.renderer_state.mutex.lock();
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
const sel = self.io.terminal.screen.selection orelse return false;
|
||||
const tl = sel.topLeft(&self.io.terminal.screen);
|
||||
self.io.terminal.screen.scroll(.{ .pin = tl });
|
||||
{
|
||||
self.renderer_state.mutex.lock();
|
||||
defer self.renderer_state.mutex.unlock();
|
||||
const sel = self.io.terminal.screen.selection orelse return false;
|
||||
const tl = sel.topLeft(&self.io.terminal.screen);
|
||||
self.io.terminal.screen.scroll(.{ .pin = tl });
|
||||
}
|
||||
|
||||
try self.queueRender();
|
||||
},
|
||||
|
||||
.scroll_page_up => {
|
||||
|
|
|
|||
|
|
@ -347,6 +347,10 @@ pub const Action = union(enum) {
|
|||
/// Scroll to the selected text.
|
||||
scroll_to_selection,
|
||||
|
||||
/// Scroll to the given absolute row in the screen with 0 being
|
||||
/// the first row.
|
||||
scroll_to_row: usize,
|
||||
|
||||
/// Scroll the screen up by one page.
|
||||
scroll_page_up,
|
||||
|
||||
|
|
@ -1077,6 +1081,7 @@ pub const Action = union(enum) {
|
|||
.scroll_to_top,
|
||||
.scroll_to_bottom,
|
||||
.scroll_to_selection,
|
||||
.scroll_to_row,
|
||||
.scroll_page_up,
|
||||
.scroll_page_down,
|
||||
.scroll_page_fractional,
|
||||
|
|
|
|||
|
|
@ -487,6 +487,7 @@ fn actionCommands(action: Action.Key) []const Command {
|
|||
.esc,
|
||||
.cursor_key,
|
||||
.set_font_size,
|
||||
.scroll_to_row,
|
||||
.scroll_page_fractional,
|
||||
.scroll_page_lines,
|
||||
.adjust_selection,
|
||||
|
|
|
|||
Loading…
Reference in New Issue