mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-27 17:53:55 +00:00
macOS: Selection for Find feature
Adds the `selection_for_search` action, with Cmd+E keybind by default. This action inputs the currently selected text into the search field without changing focus, matching standard macOS behavior.
This commit is contained in:
@@ -316,6 +316,9 @@ 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,
|
||||
|
||||
@@ -389,6 +392,7 @@ pub const Action = union(Key) {
|
||||
show_on_screen_keyboard,
|
||||
command_finished,
|
||||
start_search,
|
||||
selection_for_search,
|
||||
end_search,
|
||||
search_total,
|
||||
search_selected,
|
||||
@@ -914,3 +918,18 @@ 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,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user