From 72c0f9dd32f884fb7c0f848ca151d34f1272f1f7 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Fri, 19 Jul 2024 14:20:28 -0700 Subject: [PATCH] adjust selection --- src/Surface.zig | 4 ++-- src/config/Config.zig | 16 ++++++++-------- src/input/Binding.zig | 6 +++--- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/Surface.zig b/src/Surface.zig index 43050958c..24100544a 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -3488,12 +3488,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool .quit => try self.app.setQuit(), - .expand_selection => |direction| expand_selection: { + .adjust_selection => |direction| adjust_selection: { 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 :expand_selection; + const sel = if (screen.selection) |*sel| sel else break :adjust_selection; sel.adjust(screen, switch (direction) { .left => .left, .right => .right, diff --git a/src/config/Config.zig b/src/config/Config.zig index cc15adb83..72a3cb909 100644 --- a/src/config/Config.zig +++ b/src/config/Config.zig @@ -1329,42 +1329,42 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config { try result.keybind.set.put( alloc, .{ .key = .{ .translated = .left }, .mods = .{ .shift = true } }, - .{ .expand_selection = .left }, + .{ .adjust_selection = .left }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .right }, .mods = .{ .shift = true } }, - .{ .expand_selection = .right }, + .{ .adjust_selection = .right }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .up }, .mods = .{ .shift = true } }, - .{ .expand_selection = .up }, + .{ .adjust_selection = .up }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .down }, .mods = .{ .shift = true } }, - .{ .expand_selection = .down }, + .{ .adjust_selection = .down }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .page_up }, .mods = .{ .shift = true } }, - .{ .expand_selection = .page_up }, + .{ .adjust_selection = .page_up }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .page_down }, .mods = .{ .shift = true } }, - .{ .expand_selection = .page_down }, + .{ .adjust_selection = .page_down }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .home }, .mods = .{ .shift = true } }, - .{ .expand_selection = .home }, + .{ .adjust_selection = .home }, ); try result.keybind.set.put( alloc, .{ .key = .{ .translated = .end }, .mods = .{ .shift = true } }, - .{ .expand_selection = .end }, + .{ .adjust_selection = .end }, ); // Windowing diff --git a/src/input/Binding.zig b/src/input/Binding.zig index 53968de5e..4232ea252 100644 --- a/src/input/Binding.zig +++ b/src/input/Binding.zig @@ -195,9 +195,9 @@ pub const Action = union(enum) { scroll_page_fractional: f32, scroll_page_lines: i16, - /// Expand an existing selection in a given direction. This action + /// Adjust an existing selection in a given direction. This action /// does nothing if there is no active selection. - expand_selection: ExpandSelection, + adjust_selection: AdjustSelection, /// Jump the viewport forward or back by prompt. Positive number is the /// number of prompts to jump forward, negative is backwards. @@ -281,7 +281,7 @@ pub const Action = union(enum) { application: []const u8, }; - pub const ExpandSelection = enum { + pub const AdjustSelection = enum { left, right, up,