ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
search.h
Go to the documentation of this file.
1
20
21#pragma once
22
25#include <libplatform/keyboard.h>
26#include <stdbool.h>
27#include <stddef.h>
28
29#ifdef __cplusplus
30extern "C" {
31#endif
32
41
42/* ============================================================================
43 * Lifecycle Functions
44 * ========================================================================== */
45
54
60void log_search_destroy(void);
61
62/* ============================================================================
63 * Mode Management
64 * ========================================================================== */
65
72void log_search_enter_mode(void);
73
82void log_search_exit_mode(bool accept);
83
88bool log_search_is_entering(void);
89
94bool log_search_is_active(void);
95
96/* ============================================================================
97 * Keyboard Handling
98 * ========================================================================== */
99
109bool log_search_should_handle(int key);
110
123asciichat_error_t log_search_handle_key(keyboard_key_t key);
127
130
131/* ============================================================================
132 * Log Filtering and Display
133 * ========================================================================== */
134
153 size_t *out_count);
155 session_log_entry_t **out_entries,
156 size_t *out_count);
157
168
179bool log_search_get_match_info(const char *message, size_t *out_match_start,
180 size_t *out_match_len);
181
192
202void *log_search_copy_pattern(void);
203
204/* ============================================================================
205 * Signal-Safe Interface
206 * ========================================================================== */
207
215
222void log_search_signal_cancel(void);
223
231
232/* ============================================================================
233 * Re-render Notification
234 * ========================================================================== */
235
244
245/* ============================================================================
246 * Internal Access (for atomic rendering)
247 * ========================================================================== */
248
256void *log_search_get_mutex(void);
257
265
273
280const char *log_search_get_input_buffer(void);
281
289
290#ifdef __cplusplus
291}
292#endif
Synchronized per-thread pending error stacks and value snapshots. SET_ERRNO pushes,...
unsigned int width
Definition fft.c:24
asciichat_error_t
Error and exit codes - unified status values (0-255).
Definition error_codes.h:48
struct session_log_buffer session_log_buffer_t
Thread-safe fixed-size history ring for session-screen log lines.
asciichat_error_t log_search_init(void)
Initialize interactive grep subsystem.
Definition search.c:148
void * log_search_get_mutex(void)
Get the mutex protecting grep state.
Definition search.c:1031
bool log_search_needs_rerender(void)
Check if screen needs immediate re-render.
Definition search.c:979
bool log_search_check_signal_cancel(void)
Check and clear the signal-cancel flag.
Definition search.c:418
void log_search_signal_cancel(void)
Cancel grep mode from a signal handler (async-signal-safe).
Definition search.c:414
bool log_search_is_entering(void)
Check if currently in input mode (typing pattern).
Definition search.c:423
void log_search_process_pending(void)
Definition search.c:489
log_search_mode_t
Search mode states.
Definition search.h:36
@ LOG_SEARCH_MODE_ACTIVE
Pattern accepted and filtering.
Definition search.h:39
@ LOG_SEARCH_MODE_ENTERING
'/' pressed, typing pattern
Definition search.h:38
@ LOG_SEARCH_MODE_INACTIVE
Not in search mode.
Definition search.h:37
bool log_search_get_global_highlight(void)
Check if global highlighting (/g flag) is enabled in current pattern.
Definition search.c:991
int log_search_get_input_len(void)
Get current input buffer length (must hold mutex).
Definition search.c:1033
void log_search_enter_mode(void)
Enter search mode (user pressed '/').
Definition search.c:233
asciichat_error_t log_search_insert_text(const char *text)
Definition search.c:501
const char * log_search_get_input_buffer(void)
Get current input buffer content (must hold mutex).
Definition search.c:1037
bool log_search_is_active(void)
Check if filtering is active.
Definition search.c:430
bool log_search_get_case_insensitive(void)
Check if case-insensitive flag is set (must hold mutex).
Definition search.c:1041
void log_search_exit_mode(bool accept)
Exit search mode.
Definition search.c:312
void * log_search_copy_pattern(void)
Get the compiled regex pattern for interactive grep (internal use).
Definition search.c:1006
bool log_search_get_match_info(const char *message, size_t *out_match_start, size_t *out_match_len)
Get match info for highlighting a log message.
Definition search.c:811
bool log_search_should_handle(int key)
Check if a key should be handled by grep module.
Definition search.c:441
void log_search_destroy(void)
Clean up interactive grep subsystem.
Definition search.c:210
int log_search_get_cursor_position(void)
Get current cursor position in input buffer (must hold mutex).
Definition search.c:1035
asciichat_error_t log_search_handle_key(keyboard_key_t key)
Process keyboard input for grep.
Definition search.c:532
void log_search_render_input_line(int width)
Render grep input line at bottom of screen.
Definition search.c:772
asciichat_error_t log_search_filter_buffer(session_log_buffer_t *logs, session_log_entry_t **out_entries, size_t *out_count)
Definition search.c:603
bool log_search_is_entering_atomic(void)
Check if grep is in entering mode (async-signal-safe).
Definition search.c:409
asciichat_error_t log_search_gather_and_filter_logs(session_log_entry_t **out_entries, size_t *out_count)
Gather and filter logs for display.
Definition search.c:596
Thread-safe circular log buffer for session screens (status, splash).
One formatted session log line and its monotonic history sequence.