ascii-chat
Binary v0.16.114-28-gf5913657f
Library lib/v0.3.2-3302-gf5913657f
Video chat in your terminal
Loading...
Searching...
No Matches
errno_stacks.h File Reference

Go to the source code of this file.

Functions

void ui_errno_stacks_toggle (void)
void ui_errno_stacks_hide (void)
bool ui_errno_stacks_visible (void)
bool ui_errno_stacks_handle_key (keyboard_key_t key)

Function Documentation

◆ ui_errno_stacks_handle_key()

bool ui_errno_stacks_handle_key ( keyboard_key_t key)

Returns true when a visible errno-stack UI consumed the key.

Definition at line 517 of file errno_stacks.c.

517 {
520 return false;
521 if (!state_lock())
522 return false;
523 if (key == KEY_BACKTICK || key == KEY_ESCAPE) {
524 g_state.visible = false;
525 state_unlock();
527 return true;
528 }
529 if (key == '\t') {
530 g_state.tab = g_state.tab == ERRNO_TUI_CURRENT ? ERRNO_TUI_HISTORY
532 ui_selectable_list_reset(&g_state.list);
533 } else if (key == 's' || key == 'S') {
534 g_state.stack_sort = !g_state.stack_sort;
535 ui_selectable_list_reset(&g_state.list);
536 } else if (key == KEY_UP || key == 'k') {
537 ui_selectable_list_move(&g_state.list, g_state.count, g_state.rows, -1);
538 } else if (key == KEY_DOWN || key == 'j') {
539 ui_selectable_list_move(&g_state.list, g_state.count, g_state.rows, 1);
540 } else if (key == 'x' || key == 'X') {
541 errno_tui_state_t state = g_state;
542 state_unlock();
543 if (state.selected_current)
547 publish();
548 return true;
549 } else {
550 state_unlock();
551 return false;
552 }
553 state_unlock();
554 publish();
555 return true;
556}
bool errno_clear_if_current(uint64_t id, uint64_t generation, uint64_t error_id)
bool ui_errno_stacks_visible(void)
@ ERRNO_TUI_CURRENT
@ ERRNO_TUI_HISTORY
void ui_selectable_list_move(ui_selectable_list_t *list, int count, int rows, int delta)
void ui_selectable_list_reset(ui_selectable_list_t *list)
The useful part of errno tui row is in context, resolved_ns, group_id, group_timestamp: together they...
asciichat_error_context_t selected_context
void ui_controller_remove(ui_screen_t screen)
int ui_controller_current_screen(void)
@ UI_SCREEN_ERRNO

References errno_clear_if_current(), ERRNO_TUI_CURRENT, ERRNO_TUI_HISTORY, asciichat_error_context_t::error_id, asciichat_error_context_t::generation, errno_tui_state_t::selected_context, errno_tui_state_t::selected_current, asciichat_error_context_t::thread_id, ui_controller_current_screen(), ui_controller_remove(), ui_errno_stacks_visible(), UI_SCREEN_ERRNO, ui_selectable_list_move(), and ui_selectable_list_reset().

Referenced by ui_status_display_interactive().

◆ ui_errno_stacks_hide()

void ui_errno_stacks_hide ( void )

Definition at line 501 of file errno_stacks.c.

501 {
502 if (!state_lock())
503 return;
504 g_state.visible = false;
505 state_unlock();
507}

References ui_controller_remove(), and UI_SCREEN_ERRNO.

Referenced by ui_controller_toggle_logs().

◆ ui_errno_stacks_toggle()

void ui_errno_stacks_toggle ( void )

Toggle the diagnostic errno-stack terminal UI. Available only in diagnostic builds.

Definition at line 483 of file errno_stacks.c.

483 {
484#if defined(ASCIICHAT_DIAGNOSTIC_UI)
485 if (!state_lock())
486 return;
487 g_state.visible = !g_state.visible;
488 if (g_state.visible)
489 ui_selectable_list_reset(&g_state.list);
490 if (g_state.visible)
491 g_state.output_fd = ui_controller_active_fd();
492 bool visible = g_state.visible;
493 state_unlock();
494 if (visible)
495 publish();
496 else
498#endif
499}
int ui_controller_active_fd(void)

References ui_controller_active_fd(), ui_controller_remove(), UI_SCREEN_ERRNO, and ui_selectable_list_reset().

Referenced by ui_status_display_interactive().

◆ ui_errno_stacks_visible()

bool ui_errno_stacks_visible ( void )

Definition at line 509 of file errno_stacks.c.

509 {
510 if (!state_lock())
511 return false;
512 bool visible = g_state.visible;
513 state_unlock();
514 return visible;
515}

Referenced by ui_errno_stacks_handle_key().