apprt actions for search progress
parent
d4a2f3db71
commit
2ee2d000f5
|
|
@ -752,6 +752,16 @@ typedef struct {
|
|||
const char* needle;
|
||||
} ghostty_action_start_search_s;
|
||||
|
||||
// apprt.action.SearchTotal
|
||||
typedef struct {
|
||||
ssize_t total;
|
||||
} ghostty_action_search_total_s;
|
||||
|
||||
// apprt.action.SearchSelected
|
||||
typedef struct {
|
||||
ssize_t selected;
|
||||
} ghostty_action_search_selected_s;
|
||||
|
||||
// terminal.Scrollbar
|
||||
typedef struct {
|
||||
uint64_t total;
|
||||
|
|
@ -818,6 +828,8 @@ typedef enum {
|
|||
GHOSTTY_ACTION_COMMAND_FINISHED,
|
||||
GHOSTTY_ACTION_START_SEARCH,
|
||||
GHOSTTY_ACTION_END_SEARCH,
|
||||
GHOSTTY_ACTION_SEARCH_TOTAL,
|
||||
GHOSTTY_ACTION_SEARCH_SELECTED,
|
||||
} ghostty_action_tag_e;
|
||||
|
||||
typedef union {
|
||||
|
|
@ -852,6 +864,8 @@ typedef union {
|
|||
ghostty_action_progress_report_s progress_report;
|
||||
ghostty_action_command_finished_s command_finished;
|
||||
ghostty_action_start_search_s start_search;
|
||||
ghostty_action_search_total_s search_total;
|
||||
ghostty_action_search_selected_s search_selected;
|
||||
} ghostty_action_u;
|
||||
|
||||
typedef struct {
|
||||
|
|
|
|||
|
|
@ -307,6 +307,12 @@ pub const Action = union(Key) {
|
|||
/// End the search overlay, clearing the search state and hiding it.
|
||||
end_search,
|
||||
|
||||
/// The total number of matches found by the search.
|
||||
search_total: SearchTotal,
|
||||
|
||||
/// The currently selected search match index (1-based).
|
||||
search_selected: SearchSelected,
|
||||
|
||||
/// Sync with: ghostty_action_tag_e
|
||||
pub const Key = enum(c_int) {
|
||||
quit,
|
||||
|
|
@ -366,6 +372,8 @@ pub const Action = union(Key) {
|
|||
command_finished,
|
||||
start_search,
|
||||
end_search,
|
||||
search_total,
|
||||
search_selected,
|
||||
};
|
||||
|
||||
/// Sync with: ghostty_action_u
|
||||
|
|
@ -793,3 +801,33 @@ pub const StartSearch = struct {
|
|||
};
|
||||
}
|
||||
};
|
||||
|
||||
pub const SearchTotal = struct {
|
||||
total: ?usize,
|
||||
|
||||
// Sync with: ghostty_action_search_total_s
|
||||
pub const C = extern struct {
|
||||
total: isize,
|
||||
};
|
||||
|
||||
pub fn cval(self: SearchTotal) C {
|
||||
return .{
|
||||
.total = if (self.total) |t| @intCast(t) else -1,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
pub const SearchSelected = struct {
|
||||
selected: ?usize,
|
||||
|
||||
// Sync with: ghostty_action_search_selected_s
|
||||
pub const C = extern struct {
|
||||
selected: isize,
|
||||
};
|
||||
|
||||
pub fn cval(self: SearchSelected) C {
|
||||
return .{
|
||||
.selected = if (self.selected) |s| @intCast(s) else -1,
|
||||
};
|
||||
}
|
||||
};
|
||||
|
|
|
|||
|
|
@ -745,6 +745,8 @@ pub const Application = extern struct {
|
|||
.redo,
|
||||
.start_search,
|
||||
.end_search,
|
||||
.search_total,
|
||||
.search_selected,
|
||||
=> {
|
||||
log.warn("unimplemented action={}", .{action});
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Reference in New Issue