summaryrefslogtreecommitdiff
path: root/src/Surface.zig
diff options
context:
space:
mode:
authorfn ⌃ ⌥ <70830482+FnControlOption@users.noreply.github.com>2025-05-03 09:07:12 -0700
committerMitchell Hashimoto <m@mitchellh.com>2025-05-06 16:26:22 -0700
commit071531c5c5233f44e32619a6d6486a6bebfe18b2 (patch)
treef96e8c6448d43516cd9f0f668717998b5c753f4e /src/Surface.zig
parenteb7368699b5486fb12742e461fa0585327daa65f (diff)
Add "Scroll to Selection" command
Diffstat (limited to 'src/Surface.zig')
-rw-r--r--src/Surface.zig8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Surface.zig b/src/Surface.zig
index 6e62f6639..0d4c9d984 100644
--- a/src/Surface.zig
+++ b/src/Surface.zig
@@ -4119,6 +4119,14 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
}, .unlocked);
},
+ .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 });
+ },
+
.scroll_page_up => {
const rows: isize = @intCast(self.size.grid().rows);
self.io.queueMessage(.{