aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordam <dam@gudinoff>2023-08-24 09:15:44 +0100
committerdam <dam@gudinoff>2023-08-24 09:15:44 +0100
commit9ea152093b2eb2c3704cc7fbaa9e6cc5ae3d80f8 (patch)
tree57ec88407363e5974ab9b9df84dd93fb11912c06
parente475592b3f331a5dd47217c156354d03399c45b0 (diff)
downloadtask-time-tracker-9ea152093b2eb2c3704cc7fbaa9e6cc5ae3d80f8.tar.zst
task-time-tracker-9ea152093b2eb2c3704cc7fbaa9e6cc5ae3d80f8.zip
Replacing ncurses with tio.
-rw-r--r--tio.jai116
-rw-r--r--ttt.jai215
2 files changed, 237 insertions, 94 deletions
diff --git a/tio.jai b/tio.jai
new file mode 100644
index 0000000..37c7e4a
--- /dev/null
+++ b/tio.jai
@@ -0,0 +1,116 @@
+
+terminal_state : struct {
+ // size : ivec2;
+ width: s32;
+ height: s32;
+ // cursor := ivec2.{-1, -1}; // {-1, -1} if cursor hidden
+ x: s32 = -1;
+ y: s32 = -1;
+ last_mode : Graphics_Mode;
+}
+
+#if OS == .LINUX {
+ #import "POSIX";
+
+ __term : My_Termios;
+
+ My_Termios :: struct {
+ c_iflag : u32;
+ c_oflag : u32;
+ c_cflag : u32;
+ c_lflag : u32;
+ unknown_pad : u8;
+ c_cc : [32]u8;
+ c_ispeed : u32;
+ c_ospeed : u32;
+ }
+
+ libc :: #system_library "libc";
+ tcsetattr :: (fd : s32, optional_actions : s32, termios_p : *My_Termios) -> s32 #foreign libc;
+ tcgetattr :: (fd : s32, termios_p : *My_Termios) -> s32 #foreign libc;
+}
+else {
+ assert(false, "unsupported OS\n");
+}
+
+Graphics_Mode :: struct {
+ foreground : Color;
+ background : Color;
+ attr_flags : enum_flags u8 {
+ F_BOLD :: 0x1;
+ F_DIM :: 0x2;
+ F_ITALIC :: 0x4;
+ F_UNDERLINE :: 0x8;
+ F_BLINKING :: 0x10;
+ F_INVERSE :: 0x20;
+ F_STRIKETHROUGH :: 0x40;
+ }
+ // attrs : [MAX_ATTRS]bool;
+ // 0 - bold (on/off/keep)
+ // 1 - dim/faint
+ // 2 - italic
+ // 3 - underline
+ // 4 - blinking
+ // 5 - inverse
+ // 6 - strikethrough
+ fcol256 : u8;
+ bcol256 : u8;
+}
+
+Color :: enum u8 {
+ RESET :: 0;
+ DEFAULT :: 39;
+ COLOR256 :: 38;
+
+ BLACK :: 30;
+ RED :: 31;
+ GREEN :: 32;
+ YELLOW :: 33;
+ BLUE :: 34;
+ MAGENTA :: 35;
+ CYAN :: 36;
+ WHITE :: 37;
+
+ BRIGHT_BLACK :: 90;
+ BRIGHT_RED :: 91;
+ BRIGHT_GREEN :: 92;
+ BRIGHT_YELLOW :: 93;
+ BRIGHT_BLUE :: 94;
+ BRIGHT_MAGENTA :: 95;
+ BRIGHT_CYAN :: 96;
+ BRIGHT_WHITE :: 97;
+}
+
+__old_logger : type_of(context.logger);
+
+initialize :: () {
+ #if OS == .LINUX {
+ tcgetattr(STDIN_FILENO, *__term);
+ } else {
+ assert(false, "procedure call on unsupported OS\n");
+ }
+}
+
+terminate :: () {
+ #if OS == .LINUX {
+ tcsetattr(STDIN_FILENO, 0, *__term); // return echo
+
+ tio_write("\e[?47l"); // restore screen
+ tio_write("\e8"); // restore cursor
+ tio_write("\e[?25h"); // show cursor
+ tio_write("\e[?30h"); // show scrollbar
+ terminal_state = .{};
+
+ context.logger = __old_logger;
+ } else {
+ assert(false, "procedure call on unsupported OS\n");
+ }
+}
+
+tio_write :: (str : string) {
+ #if OS == .LINUX {
+ write(STDIN_FILENO, str.data, xx str.count);
+ } else {
+ assert(false, "procedure call on unsupported OS\n");
+ }
+}
diff --git a/ttt.jai b/ttt.jai
index f51fdb5..b3a1cd3 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -25,12 +25,31 @@
#import "File";
#import "File_Utilities";
#import "String";
-#import "curses";
+//#import "curses";
+// #import "kscurses";
+TIO :: #import "tio";
#load "Integer_Saturating_Arithmetic.jai";
// TODO List:
// [ ] Every time we add or remove tasks to the database, it may be reallocated, thus making the selected_task and active_task pointers invalid. Check if this is messing up the app.
+stdscr: *void; // TODO DAM
+A_BOLD: s32 = 0; // TODO DAM
+COLOR_PAIR :: (a: s32) -> s32 { return 0; } // TODO DAM
+ERR :: -1; // TODO DAM
+KEY_RESIZE :: 410; // TODO DAM
+KEY_F2 :: 266; // TODO DAM
+KEY_F5 :: 269; // TODO DAM
+KEY_HOME :: 262; // TODO DAM
+KEY_UP :: 259; // TODO DAM
+KEY_DOWN :: 258; // TODO DAM
+KEY_NPAGE :: 338; // TODO DAM
+KEY_PPAGE :: 339; // TODO DAM
+KEY_END :: 360; // TODO DAM
+KEY_BACKSPACE :: 263; // TODO DAM
+KEY_DC :: 330; // TODO DAM
+WINDOW :: struct { } // TODO DAM
+
VERSION :: "2.0"; // Use only 3 chars (to fit layouts).
YEAR :: "2023";
@@ -97,7 +116,7 @@ error_window : *WINDOW = null;
error_time_limit := Apollo_Time.{0, 0};
print_error :: (format :string, args : .. Any) {
- if stdscr == null || isendwin() == true { // Not in ncurses mode?
+ if stdscr == null { // || isendwin() == true { // Not in ncurses mode? TODO DAM
print(format, ..args);
print("\n");
}
@@ -106,16 +125,16 @@ print_error :: (format :string, args : .. Any) {
w_size_x: s32 = ifx size_x > 120 then 120 else size_x - 2;
w_size_y: s32 = 4;
if (error_window == null) {
- error_window = newwin(w_size_y, w_size_x, (size_y - w_size_y) / 2, (size_x - w_size_x) / 2);
- wattron(error_window, COLOR_PAIR(xx Styles.ERROR));
- wborder(error_window, CHAR_SPACE, CHAR_SPACE, 0, 0, ACS_HLINE, ACS_HLINE, ACS_HLINE, ACS_HLINE);
- mvwprintw(error_window, 0, 1, " Error ");
- wmove(error_window, 1, 0);
+ //error_window = newwin(w_size_y, w_size_x, (size_y - w_size_y) / 2, (size_x - w_size_x) / 2); TODO DAM
+ //wattron(error_window, COLOR_PAIR(xx Styles.ERROR)); TODO DAM
+ //wborder(error_window, CHAR_SPACE, CHAR_SPACE, 0, 0, ACS_HLINE, ACS_HLINE, ACS_HLINE, ACS_HLINE); TODO DAM
+ //mvwprintw(error_window, 0, 1, " Error "); TODO DAM
+ //wmove(error_window, 1, 0); TODO DAM
}
else {
- waddch(error_window, CHAR_SPACE);
+ //waddch(error_window, CHAR_SPACE); TODO DAM
}
- wprintw(error_window, temp_c_string(tprint(format, args)));
+ //wprintw(error_window, temp_c_string(tprint(format, args))); TODO DAM
error_time_limit = current_time_monotonic() + seconds_to_apollo(5);
}
}
@@ -126,12 +145,12 @@ draw_error_window :: () {
// Hide error window after time-limit or if terminal is shrank.
w_size_x: s32;
w_size_y: s32;
- getmaxyx(error_window, *w_size_y, *w_size_x);
+ //getmaxyx(error_window, *w_size_y, *w_size_x); TODO DAM
if (current_time_monotonic() >= error_time_limit
|| size_x - w_size_x < 2
|| size_y - w_size_y < 2
) {
- delwin(error_window);
+ //delwin(error_window); TODO DAM
error_window = null;
return;
}
@@ -139,12 +158,12 @@ draw_error_window :: () {
// Adjust error window position.
pos_x := (size_x - w_size_x) / 2;
pos_y := (size_y - w_size_y) / 2;
- mvwin(error_window, pos_y, pos_x);
+ //mvwin(error_window, pos_y, pos_x); TODO DAM
// Avoid being overwritten by main window content.
- refresh();
- touchwin(error_window);
- wrefresh(error_window);
+ //refresh(); TODO DAM
+ //touchwin(error_window); TODO DAM
+ //wrefresh(error_window); TODO DAM
}
trigger_autosave :: () {
@@ -152,8 +171,8 @@ trigger_autosave :: () {
}
show_processing :: () {
- mvaddch(0, 0, ACS_DIAMOND);
- refresh();
+ //mvaddch(0, 0, ACS_DIAMOND); TODO DAM
+ //refresh(); TODO DAM
}
// Returns true if string to_compare is equal to any of the other passed strings, false otherwise.
@@ -243,18 +262,22 @@ mvprintw_time :: (y: s32, x: s32, time: s64, space: s32) -> int {
right_padding := space - TIME_CHARS - left_padding;
if time < 0 {
- return mvprintw(y, x, "%*s - %*s", left_padding, "", right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s - %*s", left_padding, "", right_padding, ""); TODO DAM
}
else if time == 0 {
- return mvprintw(y, x, "%*s 0 %*s", left_padding, "", right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s 0 %*s", left_padding, "", right_padding, ""); TODO DAM
}
else if time < SECONDS_IN_MINUTE {
- return mvprintw(y, x, "%*s%3jds %*s", left_padding, "", time, right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s%3jds %*s", left_padding, "", time, right_padding, ""); TODO DAM
}
else if time < #run mul_f64_s64(100, SECONDS_IN_HOUR) {
hours := time / SECONDS_IN_HOUR;
minutes := (time - (hours * SECONDS_IN_HOUR) ) / SECONDS_IN_MINUTE;
- return mvprintw(y, x, "%*s%02jd:%02jd%*s", left_padding, "", hours, minutes, right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s%02jd:%02jd%*s", left_padding, "", hours, minutes, right_padding, ""); TODO DAM
}
else if time < #run mul_f64_s64(9999.5, SECONDS_IN_DAY) {
value := cast(float64) time / SECONDS_IN_DAY;
@@ -262,7 +285,8 @@ mvprintw_time :: (y: s32, x: s32, time: s64, space: s32) -> int {
ifx time >= #run mul_f64_s64(99.95, SECONDS_IN_DAY) then 0 else
ifx time >= #run mul_f64_s64(9.995, SECONDS_IN_DAY) then 1 else
2;
- return mvprintw(y, x, "%*s%4.*fd%*s", left_padding, "", decimals, value, right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s%4.*fd%*s", left_padding, "", decimals, value, right_padding, ""); TODO DAM
}
else if time < #run mul_f64_s64(9999.5, SECONDS_IN_YEAR) {
value := cast(float64) time / SECONDS_IN_YEAR;
@@ -270,12 +294,13 @@ mvprintw_time :: (y: s32, x: s32, time: s64, space: s32) -> int {
ifx time >= #run mul_f64_s64(99.95, SECONDS_IN_YEAR) then 0 else
ifx time >= #run mul_f64_s64(9.995, SECONDS_IN_YEAR) then 1 else
2;
- return mvprintw(y, x, "%*s%4.*fy%*s", left_padding, "", decimals, value, right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s%4.*fy%*s", left_padding, "", decimals, value, right_padding, ""); TODO DAM
}
else {
// TODO Set back the unicode emoji once ncurses has been replaced.
- // return mvprintw(y, x, "%*s ∞ %*s", left_padding, "", right_padding, "");
- return mvprintw(y, x, "%*s inf %*s", left_padding, "", right_padding, "");
+ return 0;
+ // return mvprintw(y, x, "%*s ∞ %*s", left_padding, "", right_padding, ""); TODO DAM
}
}
@@ -876,22 +901,23 @@ initialize_tui :: () {
}
}
- // TODO
- // setlocale(LC_ALL, "C.UTF-8"); // Sets locale for C library functions; Allows usage of UTF-8.
- stdscr = initscr(); // Start curses mode.
- cbreak(); // Line buffering disabled; pass on everty thing to me.
- keypad(stdscr, true); // I need those nifty F1..F12.
- curs_set(0); // Set cursor invisible.
- noecho(); // Disable echoing input characters.
+ // TODO DAM
+ TIO.initialize();
+ TIO.terminate(); // TODO DAM
+ //stdscr = initscr(); // Start curses mode. TODO DAM
+ //cbreak(); // Line buffering disabled; pass on everty thing to me. TODO DAM
+ //keypad(stdscr, true); // I need those nifty F1..F12. TODO DAM
+ //curs_set(0); // Set cursor invisible. TODO DAM
+ //noecho(); // Disable echoing input characters. TODO DAM
// Initialize pairs of colors.
- start_color();
- use_default_colors(); // Using default (-1) instead of COLOR_BLACK.
- init_pair(xx Styles.SELECTED, COLOR_BLACK, COLOR_CYAN);
- init_pair(xx Styles.SELECTED_INVERTED, COLOR_CYAN, -1);
- init_pair(xx Styles.ACTIVE, COLOR_BLUE, -1);
- init_pair(xx Styles.ACTIVE_SELECTED, COLOR_WHITE, COLOR_BLUE);
- init_pair(xx Styles.ERROR, COLOR_RED, -1);
+ //start_color(); TODO DAM
+ //use_default_colors(); // Using default (-1) instead of COLOR_BLACK. TODO DAM
+ //init_pair(xx Styles.SELECTED, COLOR_BLACK, COLOR_CYAN); TODO DAM
+ //init_pair(xx Styles.SELECTED_INVERTED, COLOR_CYAN, -1); TODO DAM
+ //init_pair(xx Styles.ACTIVE, COLOR_BLUE, -1); TODO DAM
+ //init_pair(xx Styles.ACTIVE_SELECTED, COLOR_WHITE, COLOR_BLUE); TODO DAM
+ //init_pair(xx Styles.ERROR, COLOR_RED, -1); TODO DAM
}
update_layout :: () {
@@ -930,11 +956,11 @@ draw_tui :: (db: *Database, layout: *Layout) {
now_week_day := to_calendar(now_utc, .LOCAL).day_of_week_starting_at_0;
// Reset theme and clear screen.
- attrset(A_NORMAL);
- erase();
+ //attrset(A_NORMAL); TODO DAM
+ //erase(); TODO DAM
// Draw outer border.
- box(stdscr, 0, 0);
+ //box(stdscr, 0, 0); TODO DAM
// Draw table grids.
// TODO Maybe this could be simplified?
@@ -943,11 +969,11 @@ draw_tui :: (db: *Database, layout: *Layout) {
for 0..layout.columns.count-2 {
column := layout.columns[it];
x += 1 + column.width;
- mvaddch(xx y, xx x, ACS_TTEE);
+ //mvaddch(xx y, xx x, ACS_TTEE); TODO DAM
for row: 1..size_y-1 {
- mvaddch(xx row, xx x, ACS_VLINE);
+ //mvaddch(xx row, xx x, ACS_VLINE); TODO DAM
}
- mvaddch(size_y-1, xx x, ACS_BTEE);
+ //mvaddch(size_y-1, xx x, ACS_BTEE); TODO DAM
}
@@ -959,7 +985,7 @@ draw_tui :: (db: *Database, layout: *Layout) {
// Headers : title
x += 1;
col = *layout.columns[L_TITLE_IDX];
- mvaddstr(xx y, xx (x + col.alignment_offset), ifx db == *archive then layout.archive_title.data else col.header.data);
+ //mvaddstr(xx y, xx (x + col.alignment_offset), ifx db == *archive then layout.archive_title.data else col.header.data); TODO DAM
x += col.width;
// Headers : days
@@ -969,24 +995,24 @@ draw_tui :: (db: *Database, layout: *Layout) {
// Apply theme.
if (idx == now_week_day && active_task != null) {
- attron(COLOR_PAIR(xx Styles.ACTIVE) | A_BOLD);
+ // attron(COLOR_PAIR(xx Styles.ACTIVE) | A_BOLD); TODO DAM
}
else if (idx == now_week_day) {
- attron(COLOR_PAIR(xx Styles.SELECTED_INVERTED) | A_BOLD);
+ // attron(COLOR_PAIR(xx Styles.SELECTED_INVERTED) | A_BOLD); TODO DAM
}
col = *layout.columns[L_DAYS_IDX + idx];
- mvaddstr(xx y, xx (x + col.alignment_offset), col.header.data);
+ //mvaddstr(xx y, xx (x + col.alignment_offset), col.header.data); TODO DAM
x += col.width;
// Reset theme.
- attrset(A_NORMAL);
+ //attrset(A_NORMAL); TODO DAM
}
// Headers : total
x += 1;
col = *layout.columns[L_TOTAL_IDX];
- mvaddstr(xx y, xx (x + col.alignment_offset), col.header.data);
+ //mvaddstr(xx y, xx (x + col.alignment_offset), col.header.data); TODO DAM
///////////////////////////////////////////////////////////////////////////
@@ -1008,19 +1034,19 @@ draw_tui :: (db: *Database, layout: *Layout) {
// Apply theme.
if (task == active_task && task == selected_task) {
- attron(COLOR_PAIR(xx Styles.ACTIVE_SELECTED) | A_BOLD);
+ // attron(COLOR_PAIR(xx Styles.ACTIVE_SELECTED) | A_BOLD); TODO DAM
}
else if (task == selected_task) {
- attron(COLOR_PAIR(xx Styles.SELECTED));
+ // attron(COLOR_PAIR(xx Styles.SELECTED)); TODO DAM
}
else if (task == active_task) {
- attron(COLOR_PAIR(xx Styles.ACTIVE) | A_BOLD);
+ // attron(COLOR_PAIR(xx Styles.ACTIVE) | A_BOLD); TODO DAM
}
// Task title.
x += 1;
column_width = layout.columns[L_TITLE_IDX].width;
- mvprintw(xx y, xx x, "%-*.*s", column_width, column_width, temp_c_string(xx task.name)); //task.name); TODO Fix required for LLVM/Cncurses.
+ // mvprintw(xx y, xx x, "%-*.*s", column_width, column_width, temp_c_string(xx task.name)); //task.name); TODO Fix required for LLVM/Cncurses. TODO DAM
x += column_width;
// Task times.
@@ -1040,7 +1066,7 @@ draw_tui :: (db: *Database, layout: *Layout) {
mvprintw_time(xx y, xx x, total_time, xx layout.columns[L_TOTAL_IDX].width);
// Reset theme.
- attrset(A_NORMAL);
+ //attrset(A_NORMAL); TODO DAM
}
@@ -1048,10 +1074,10 @@ draw_tui :: (db: *Database, layout: *Layout) {
// Draw selected/total tasks.
size := 1 + count_digits(db.selected_idx + 1) + 1 + count_digits(db.tasks.count) + 1; // " XXX/YYY "
if (size <= layout.columns[L_TITLE_IDX].width) {
- mvprintw(size_y - 1, 1, " %td/%zd ", db.selected_idx + 1, db.tasks.count);
+ // mvprintw(size_y - 1, 1, " %td/%zd ", db.selected_idx + 1, db.tasks.count); TODO DAM
}
else {
- mvprintw(size_y - 1, 1, "%td", db.selected_idx + 1);
+ // mvprintw(size_y - 1, 1, "%td", db.selected_idx + 1); TODO DAM
}
@@ -1067,10 +1093,10 @@ draw_tui :: (db: *Database, layout: *Layout) {
// Apply theme.
if (idx == now_week_day && active_task != null) {
- attron(COLOR_PAIR(xx Styles.ACTIVE) | A_BOLD);
+ // attron(COLOR_PAIR(xx Styles.ACTIVE) | A_BOLD); TODO DAM
}
else if (idx == now_week_day) {
- attron(COLOR_PAIR(xx Styles.SELECTED_INVERTED) | A_BOLD);
+ // attron(COLOR_PAIR(xx Styles.SELECTED_INVERTED) | A_BOLD); TODO DAM
}
column_width = layout.columns[L_DAYS_IDX + idx].width;
@@ -1079,7 +1105,7 @@ draw_tui :: (db: *Database, layout: *Layout) {
x += column_width;
// Reset theme.
- attrset(A_NORMAL);
+ //attrset(A_NORMAL); TODO DAM
}
x += 1;
mvprintw_time(xx y, xx x, total_time, xx layout.columns[L_TOTAL_IDX].width);
@@ -1098,15 +1124,15 @@ free_memory :: () {
read_input_string_padded :: (row: int, column: int, style: s32, length: int, padding: int) -> string {
str := talloc_string(length);
memset(str.data, 0, str.count);
- attron(style | A_UNDERLINE);
- mvprintw(xx row, xx column, "%*s", padding, "");
- echo();
- curs_set(1);
- mvgetnstr(xx row, xx column, str.data, xx length);
+ // attron(style | A_UNDERLINE); TODO DAM
+ // mvprintw(xx row, xx column, "%*s", padding, ""); TODO DAM
+ //echo(); TODO DAM
+ //curs_set(1); TODO DAM
+ //mvgetnstr(xx row, xx column, str.data, xx length); TODO DAM
truncate_string(str, length);
- noecho();
- curs_set(0);
- attrset(A_NORMAL);
+ //noecho(); TODO DAM
+ //curs_set(0); TODO DAM
+ //attrset(A_NORMAL); TODO DAM
return str;
}
@@ -1116,14 +1142,14 @@ read_input_string :: (row: int, column: int, style: s32, length: int) -> string
// Returns success.
read_input_int :: (row: int, style: s32, message: string) -> value: int, success: bool {
- attron(xx style);
- move(xx row, 1);
- addch(ACS_CKBOARD);
- addstr(message.data); // TODO Convert to C type
- attrset(A_NORMAL);
+ // attron(xx style); TODO DAM
+ //move(xx row, 1); TODO DAM
+ //addch(ACS_CKBOARD); TODO DAM
+ //addstr(message.data); // TODO Convert to C type TODO DAM
+ //attrset(A_NORMAL); TODO DAM
// Get line number.
- input_pos_x := getcurx(stdscr);
+ input_pos_x := 0;//getcurx(stdscr); TODO DAM
input_width := size_x - input_pos_x - 1;
str := read_input_string(row, input_pos_x, style, input_width);
@@ -1135,16 +1161,17 @@ read_input_int :: (row: int, style: s32, message: string) -> value: int, success
read_input_char :: (row: int, style: int, message: string) -> s32 {
assert(message.data != null, ASSERT_NOT_NULL, "message"); // TODO Improve this check?
- attron(xx style);
- move(xx row, 1);
+ // attron(xx style); TODO DAM
+ //move(xx row, 1); TODO DAM
for 0..size_x-3 {
//for (int idx = 0; idx < size_x - 2; idx++) { // TODO check what's going on here.
- addch(ACS_CKBOARD);
+ //addch(ACS_CKBOARD); TODO DAM
}
- mvaddstr(xx row, 2, message.data);
- attrset(A_NORMAL);
+ //mvaddstr(xx row, 2, message.data); TODO DAM
+ //attrset(A_NORMAL); TODO DAM
- return getch();
+ //return getch(); TODO DAM
+ return 0;
}
// Retuns true if user presses enter, false otherwise.
@@ -1334,13 +1361,13 @@ main :: () {
db := *database;
layout := *layouts[Layouts.COMPACT];
- flushinp();
- ungetch(KEY_RESIZE);
+ //flushinp(); TODO DAM
+ //ungetch(KEY_RESIZE); TODO DAM
while (true) {
if (is_terminal_too_small) {
INVALID_WINDOW_MESSAGE :: "Terminal is too small: minimum 60x3.";
- mvaddstr(size_y / 2, (size_x - xx INVALID_WINDOW_MESSAGE.count) / 2, INVALID_WINDOW_MESSAGE);
+ //mvaddstr(size_y / 2, (size_x - xx INVALID_WINDOW_MESSAGE.count) / 2, INVALID_WINDOW_MESSAGE); TODO DAM
}
else {
draw_tui(db, layout);
@@ -1348,11 +1375,11 @@ main :: () {
}
reset_temporary_storage();
- timeout(INPUT_TIMEOUT_MS);
- key := getch();
+ //timeout(INPUT_TIMEOUT_MS); TODO DAM
+ key := 0; // getch(); TODO DAM
if key == #char "q" || key == #char "Q" break;
update_times(*database);
- timeout(INPUT_AWAIT_INF);
+ //timeout(INPUT_AWAIT_INF); TODO DAM
// TODO WIP Remove `selected_task` and `active_task` and helper functions.
selected_task := get_selected_task(db);
@@ -1387,8 +1414,8 @@ main :: () {
// When terminal is resized.
case KEY_RESIZE;
- clear();
- getmaxyx(stdscr, *size_y, *size_x);
+ //clear(); TODO DAM
+ //getmaxyx(stdscr, *size_y, *size_x); TODO DAM
is_terminal_too_small = size_x < 60 || size_y < 3;
update_layout();
layout = *layouts[ifx size_x > 100 then Layouts.NORMAL else Layouts.COMPACT];
@@ -1428,8 +1455,8 @@ main :: () {
trigger_autosave();
// Force rename action.
- flushinp();
- ungetch(KEY_F(2));
+ //flushinp(); TODO DAM
+ //ungetch(KEY_F(2)); TODO DAM
case KEY_F2;
if (selected_task == null) continue;
@@ -1735,11 +1762,11 @@ main :: () {
if (error_saving) {
print_error("Press any key to close.");
draw_error_window();
- timeout(INPUT_AWAIT_INF);
- getch();
+ //timeout(INPUT_AWAIT_INF); TODO DAM
+ //getch(); TODO DAM
}
- endwin();
+ //endwin(); TODO DAM
exit(xx ifx error_saving then 1 else 0);
}