mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 05:50:27 +00:00
rename the selection search binding, unify into start_search action
This commit is contained in:
@@ -5163,12 +5163,12 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool
|
||||
);
|
||||
},
|
||||
|
||||
.selection_for_search => {
|
||||
.search_selection => {
|
||||
const selection = try self.selectionString(self.alloc) orelse return false;
|
||||
return try self.rt_app.performAction(
|
||||
.{ .surface = self },
|
||||
.selection_for_search,
|
||||
.{ .text = selection },
|
||||
.start_search,
|
||||
.{ .needle = selection },
|
||||
);
|
||||
},
|
||||
|
||||
|
||||
@@ -316,9 +316,6 @@ pub const Action = union(Key) {
|
||||
/// Start the search overlay with an optional initial needle.
|
||||
start_search: StartSearch,
|
||||
|
||||
/// Input the selected text into the search field.
|
||||
selection_for_search: SelectionForSearch,
|
||||
|
||||
/// End the search overlay, clearing the search state and hiding it.
|
||||
end_search,
|
||||
|
||||
@@ -392,7 +389,6 @@ pub const Action = union(Key) {
|
||||
show_on_screen_keyboard,
|
||||
command_finished,
|
||||
start_search,
|
||||
selection_for_search,
|
||||
end_search,
|
||||
search_total,
|
||||
search_selected,
|
||||
@@ -919,17 +915,4 @@ pub const SearchSelected = struct {
|
||||
}
|
||||
};
|
||||
|
||||
pub const SelectionForSearch = struct {
|
||||
text: [:0]const u8,
|
||||
|
||||
// Sync with: ghostty_action_selection_for_search_s
|
||||
pub const C = extern struct {
|
||||
text: [*:0]const u8,
|
||||
};
|
||||
|
||||
pub fn cval(self: SelectionForSearch) C {
|
||||
return .{
|
||||
.text = self.text.ptr,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -6588,7 +6588,7 @@ pub const Keybinds = struct {
|
||||
try self.set.putFlags(
|
||||
alloc,
|
||||
.{ .key = .{ .unicode = 'e' }, .mods = .{ .super = true } },
|
||||
.selection_for_search,
|
||||
.search_selection,
|
||||
.{ .performable = true },
|
||||
);
|
||||
try self.set.putFlags(
|
||||
|
||||
@@ -368,8 +368,10 @@ pub const Action = union(enum) {
|
||||
/// If a previous search is active, it is replaced.
|
||||
search: []const u8,
|
||||
|
||||
/// Input the selected text into the search field.
|
||||
selection_for_search,
|
||||
/// Start a search for the current text selection. If there is no
|
||||
/// selection, this does nothing. If a search is already active, this
|
||||
/// changes the search terms.
|
||||
search_selection,
|
||||
|
||||
/// Navigate the search results. If there is no active search, this
|
||||
/// is not performed.
|
||||
@@ -1287,7 +1289,7 @@ pub const Action = union(enum) {
|
||||
.cursor_key,
|
||||
.search,
|
||||
.navigate_search,
|
||||
.selection_for_search,
|
||||
.search_selection,
|
||||
.start_search,
|
||||
.end_search,
|
||||
.reset,
|
||||
|
||||
@@ -189,10 +189,10 @@ fn actionCommands(action: Action.Key) []const Command {
|
||||
.description = "Start a search if one isn't already active.",
|
||||
}},
|
||||
|
||||
.selection_for_search => comptime &.{.{
|
||||
.action = .selection_for_search,
|
||||
.title = "Selection for Search",
|
||||
.description = "Input the selected text into the search field.",
|
||||
.search_selection => comptime &.{.{
|
||||
.action = .search_selection,
|
||||
.title = "Search Selection",
|
||||
.description = "Start a search for the current text selection.",
|
||||
}},
|
||||
|
||||
.end_search => comptime &.{.{
|
||||
|
||||
Reference in New Issue
Block a user