diff options
| -rw-r--r-- | ttt.jai | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1158,6 +1158,8 @@ read_enter_confirmation :: (row: int, style: int, message: string) -> bool { main :: () { + // TODO Implement signal handling and see modules/Debug.jai for examples. + defer report_memory_leaks(); // TODO Remove after final debug sessions. defer free_memory(); @@ -1227,6 +1229,7 @@ main :: () { " m, M Move selected task to position.\n", " g, G Select task by position.\n", " q, Q Save changes and exit.\n", + " w, W Archive duplicates and reset all tasks.\n", // TODO Improve message. " F2 Rename selected task.\n", " F5 Recalculate total times.\n", " TAB Toggle archive view.\n", @@ -1601,6 +1604,19 @@ main :: () { delete_task(db, db.selected_idx); trigger_autosave(); + case #char "w"; #through; + case #char "W"; + if (db != *database || db.tasks.count <= 0) continue; + if (read_enter_confirmation(selected_task_row, action_style, " Press enter to archive duplicates and reset all. ") == true) { // TODO Improve message. + for db.tasks { + if (append_to_csv(it, ar_file_path) == false) { + print_error("Failed to archive entry."); // TODO Improve this. + } + reset_task_times(db, it_index); + } + trigger_autosave(); + } + case KEY_HOME; select_task(db, 0); @@ -1644,5 +1660,6 @@ main :: () { } endwin(); + exit(xx ifx error_saving then 1 else 0); } |
