mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-06 18:06:33 +00:00
adjust selection
This commit is contained in:
@@ -3488,12 +3488,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||||||
|
|
||||||
.quit => try self.app.setQuit(),
|
.quit => try self.app.setQuit(),
|
||||||
|
|
||||||
.expand_selection => |direction| expand_selection: {
|
.adjust_selection => |direction| adjust_selection: {
|
||||||
self.renderer_state.mutex.lock();
|
self.renderer_state.mutex.lock();
|
||||||
defer self.renderer_state.mutex.unlock();
|
defer self.renderer_state.mutex.unlock();
|
||||||
|
|
||||||
const screen = &self.io.terminal.screen;
|
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) {
|
sel.adjust(screen, switch (direction) {
|
||||||
.left => .left,
|
.left => .left,
|
||||||
.right => .right,
|
.right => .right,
|
||||||
|
@@ -1329,42 +1329,42 @@ pub fn default(alloc_gpa: Allocator) Allocator.Error!Config {
|
|||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .left }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .left }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .left },
|
.{ .adjust_selection = .left },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .right }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .right }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .right },
|
.{ .adjust_selection = .right },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .up }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .up }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .up },
|
.{ .adjust_selection = .up },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .down }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .down }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .down },
|
.{ .adjust_selection = .down },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .page_up }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .page_up }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .page_up },
|
.{ .adjust_selection = .page_up },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .page_down }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .page_down }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .page_down },
|
.{ .adjust_selection = .page_down },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .home }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .home }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .home },
|
.{ .adjust_selection = .home },
|
||||||
);
|
);
|
||||||
try result.keybind.set.put(
|
try result.keybind.set.put(
|
||||||
alloc,
|
alloc,
|
||||||
.{ .key = .{ .translated = .end }, .mods = .{ .shift = true } },
|
.{ .key = .{ .translated = .end }, .mods = .{ .shift = true } },
|
||||||
.{ .expand_selection = .end },
|
.{ .adjust_selection = .end },
|
||||||
);
|
);
|
||||||
|
|
||||||
// Windowing
|
// Windowing
|
||||||
|
@@ -195,9 +195,9 @@ pub const Action = union(enum) {
|
|||||||
scroll_page_fractional: f32,
|
scroll_page_fractional: f32,
|
||||||
scroll_page_lines: i16,
|
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.
|
/// 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
|
/// Jump the viewport forward or back by prompt. Positive number is the
|
||||||
/// number of prompts to jump forward, negative is backwards.
|
/// number of prompts to jump forward, negative is backwards.
|
||||||
@@ -281,7 +281,7 @@ pub const Action = union(enum) {
|
|||||||
application: []const u8,
|
application: []const u8,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const ExpandSelection = enum {
|
pub const AdjustSelection = enum {
|
||||||
left,
|
left,
|
||||||
right,
|
right,
|
||||||
up,
|
up,
|
||||||
|
Reference in New Issue
Block a user