diff options
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 13 |
1 files changed, 10 insertions, 3 deletions
@@ -909,6 +909,9 @@ void free_memory() { layouts = NULL; } +#define INPUT_TIMEOUT_MS 1000 +#define INPUT_AWAIT_INF -1 + int main(int argc, char *argv[]) { reset_database(&database); @@ -993,7 +996,6 @@ int main(int argc, char *argv[]) { // TODO // When this is active, it cancels selecting text with the mouse, and breaks the creation of a new task. // Fortunatelly, this only happens when we write on the line being selected. If we only update the places that changes, this problem goes away. - timeout(1000); // Make getch() timeout after timeout(...) miliseconds. int ch = KEY_RESIZE; do { @@ -1016,6 +1018,7 @@ int main(int argc, char *argv[]) { case KEY_F(1): { + timeout(INPUT_AWAIT_INF); task_t *new_task; if (create_task(db, &new_task) == false) { // ERROR @@ -1026,7 +1029,8 @@ int main(int argc, char *argv[]) { clrtoeol(); mvaddch(row, size_x-1, ACS_VLINE); curs_set(1); - mvgetnstr(row, 2, new_task->name, MAX_TASK_NAME-1); + // TODO Make cursor blink. + mvgetnstr(row, 1, new_task->name, MAX_TASK_NAME-1); // TODO Move this empty-name-cleaning code elsewhere. bool is_empty = true; @@ -1050,6 +1054,7 @@ int main(int argc, char *argv[]) { case KEY_F(2): { + timeout(INPUT_AWAIT_INF); if (selected_task == NULL) { break; } @@ -1059,7 +1064,8 @@ int main(int argc, char *argv[]) { clrtoeol(); mvaddch(row, size_x-1, ACS_VLINE); curs_set(1); - mvgetnstr(row, 2, selected_task->name, MAX_TASK_NAME-1); + // TODO Make cursor blink. + mvgetnstr(row, 1, selected_task->name, MAX_TASK_NAME-1); curs_set(0); break; } @@ -1165,6 +1171,7 @@ int main(int argc, char *argv[]) { const char *INVALID_WINDOW_MESSAGE = "Please expand window."; mvaddstr(size_y / 2, (size_x - strlen(INVALID_WINDOW_MESSAGE)) / 2, INVALID_WINDOW_MESSAGE); } + timeout(INPUT_TIMEOUT_MS); // Make getch() timeout. } while((ch = getch()) != 'q'); update_timers(&database); |
