summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorA404M <ahmadmahmoudiprogrammer@gmail.com>2024-08-28 19:01:14 +0330
committerA404M <ahmadmahmoudiprogrammer@gmail.com>2024-08-28 19:01:14 +0330
commit353546db994b2f71eeae731209f08da1a326a2f3 (patch)
tree6a731aead5491bdfd92a9af8d664e53f03abad99 /src
parent86fb0b3918dca172ce1ce0c1c5fffd039f824a15 (diff)
q to exit
Diffstat (limited to 'src')
-rw-r--r--src/ui/tui.c17
1 files changed, 5 insertions, 12 deletions
diff --git a/src/ui/tui.c b/src/ui/tui.c
index 96de5c2..7e044c2 100644
--- a/src/ui/tui.c
+++ b/src/ui/tui.c
@@ -181,11 +181,11 @@ int tui_change_terminal_background_color(COLOR color) {
return printf("\033[%dm", color + 40);
}
-int handle_input(TUI *tui) {
+bool handle_input(TUI *tui) {
unsigned char buff[6];
read(STDIN_FILENO, &buff, 1);
if (buff[0] == 3) { // User pressd Ctr+C
- return 1;
+ return true;
} else if (buff[0] == '\x1B') { // [ESCAPE]
// TODO: fix for inputting actual <ESC>
read(STDIN_FILENO, &buff, 5);
@@ -215,15 +215,8 @@ int handle_input(TUI *tui) {
case 'l':
tui_move_right(1);
break;
- case 'c':
- tui_clear_screen();
- break;
- case 's':
- tui_save_cursor();
- break;
- case 'r':
- tui_restore_cursor();
- break;
+ case 'q':
+ return true;
case '\b':
case 127: // back space
tui_delete_before();
@@ -233,7 +226,7 @@ int handle_input(TUI *tui) {
break;
}
}
- return 0;
+ return false;
}
void tui_start_app(TUI *tui, WIDGET_BUILDER widget_builder) {