adjust_selection keybind should not be consumed if no selection

This commit is contained in:
Mitchell Hashimoto
2024-07-27 21:32:52 -07:00
parent 14e44fa2a8
commit cb9e7ab548

View File

@ -3456,12 +3456,17 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
.quit => try self.app.setQuit(),
.adjust_selection => |direction| adjust_selection: {
.adjust_selection => |direction| {
self.renderer_state.mutex.lock();
defer self.renderer_state.mutex.unlock();
const screen = &self.io.terminal.screen;
const sel = if (screen.selection) |*sel| sel else break :adjust_selection;
const sel = if (screen.selection) |*sel| sel else {
// If we don't have a selection we do not perform this
// action, allowing the keybind to fall through to the
// terminal.
return false;
};
sel.adjust(screen, switch (direction) {
.left => .left,
.right => .right,