core: bindings for navigate_search
parent
880db9fdd0
commit
ba7b816af0
|
|
@ -4918,6 +4918,19 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
|||
.{ .change_needle = text },
|
||||
.forever,
|
||||
);
|
||||
s.state.wakeup.notify() catch {};
|
||||
},
|
||||
|
||||
.navigate_search => |nav| {
|
||||
const s: *Search = if (self.search) |*s| s else return false;
|
||||
_ = s.state.mailbox.push(
|
||||
.{ .select = switch (nav) {
|
||||
.next => .next,
|
||||
.previous => .prev,
|
||||
} },
|
||||
.forever,
|
||||
);
|
||||
s.state.wakeup.notify() catch {};
|
||||
},
|
||||
|
||||
.copy_to_clipboard => |format| {
|
||||
|
|
|
|||
|
|
@ -336,6 +336,10 @@ pub const Action = union(enum) {
|
|||
/// the search is canceled. If a previous search is active, it is replaced.
|
||||
search: []const u8,
|
||||
|
||||
/// Navigate the search results. If there is no active search, this
|
||||
/// is not performed.
|
||||
navigate_search: NavigateSearch,
|
||||
|
||||
/// Clear the screen and all scrollback.
|
||||
clear_screen,
|
||||
|
||||
|
|
@ -826,6 +830,11 @@ pub const Action = union(enum) {
|
|||
}
|
||||
};
|
||||
|
||||
pub const NavigateSearch = enum {
|
||||
previous,
|
||||
next,
|
||||
};
|
||||
|
||||
pub const AdjustSelection = enum {
|
||||
left,
|
||||
right,
|
||||
|
|
@ -1157,6 +1166,7 @@ pub const Action = union(enum) {
|
|||
.text,
|
||||
.cursor_key,
|
||||
.search,
|
||||
.navigate_search,
|
||||
.reset,
|
||||
.copy_to_clipboard,
|
||||
.copy_url_to_clipboard,
|
||||
|
|
|
|||
|
|
@ -163,6 +163,16 @@ fn actionCommands(action: Action.Key) []const Command {
|
|||
.description = "Paste the contents of the selection clipboard.",
|
||||
}},
|
||||
|
||||
.navigate_search => comptime &.{ .{
|
||||
.action = .{ .navigate_search = .next },
|
||||
.title = "Next Search Result",
|
||||
.description = "Navigate to the next search result, if any.",
|
||||
}, .{
|
||||
.action = .{ .navigate_search = .previous },
|
||||
.title = "Previous Search Result",
|
||||
.description = "Navigate to the previous search result, if any.",
|
||||
} },
|
||||
|
||||
.increase_font_size => comptime &.{.{
|
||||
.action = .{ .increase_font_size = 1 },
|
||||
.title = "Increase Font Size",
|
||||
|
|
|
|||
Loading…
Reference in New Issue