aboutsummaryrefslogtreecommitdiff
path: root/ttt.jai
diff options
context:
space:
mode:
Diffstat (limited to 'ttt.jai')
-rw-r--r--ttt.jai45
1 files changed, 18 insertions, 27 deletions
diff --git a/ttt.jai b/ttt.jai
index a07502f..517723d 100644
--- a/ttt.jai
+++ b/ttt.jai
@@ -1175,8 +1175,6 @@ read_input_string :: (row: int, column: int, input_limit: int, padding: int = 0)
// TODO Draw padding (at end of inputbox)... padding was renamed to input_width... is this the best name?
// TODO Maybe add another optional arg with the placeholder text (to be preset on the input)?
- // TODO WIPWIPWIP
-
column += 1; // TODO FIX THE NCURSES INDEXING CHAOS
TUI.set_cursor_position(row, column + input_limit);
@@ -1193,15 +1191,24 @@ read_input_string :: (row: int, column: int, input_limit: int, padding: int = 0)
// Returns success.
read_input_int :: (row: int, message: string) -> value: int, success: bool {
- // 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
+ TUI.set_cursor_position(row, 2);
+ write_string(TUI.Commands.DrawingMode);
+ for 1..size_x-2 {
+ print(TUI.Drawings.Checkerboard);
+ }
+ write_string(TUI.Commands.TextMode);
+
+ TUI.set_cursor_position(row, 3);
+ write_strings(" ", message, " ");
// Get line number.
- input_pos_x := 1;//getcurx(stdscr); TODO DAM
- input_width := size_x - input_pos_x;
+ input_pos_x := 1 + 1 + 1 + message.count + 1;
+ input_width := size_x - input_pos_x - 1;
+
+ style_input := context.tui_style;
+ style_input.underline = true;
+ TUI.using_style(style_input);
+
str := read_input_string(row, input_pos_x, input_width);
value, success := parse_int(*str);
@@ -1210,22 +1217,6 @@ read_input_int :: (row: int, message: string) -> value: int, success: bool {
// Shows message to user and waits for user key press.
prompt_user_key :: (row: int, message: string) -> TUI.Key {
-/*
- assert(message.data != null, ASSERT_NOT_NULL, "message");
- attron(xx style);
- move(xx row, 1);
- for 0..size_x-3 {
- // for (int idx = 0; idx < size_x - 2; idx++) {
- addch(ACS_CKBOARD);
- }
- mvaddstr(xx row, 2, message.data);
- attrset(A_NORMAL);
-
- return getch();
-*/
-
- // TODO We still need to apply the style.
-
TUI.set_cursor_position(row, 2);
write_string(TUI.Commands.DrawingMode);
for 1..size_x-2 {
@@ -1858,7 +1849,7 @@ main :: () {
if selected_task == null continue;
TUI.using_style(action_style);
- value, success := read_input_int(selected_task_row, " Move to: ");
+ value, success := read_input_int(selected_task_row, "Move to:");
if success == false continue;
move_task(db, db.selected_idx, value-1); // -1 to adjust for zero based index
trigger_autosave();
@@ -1869,7 +1860,7 @@ main :: () {
if selected_task == null continue;
TUI.using_style(action_style);
- value, success := read_input_int(selected_task_row, " Go to: ");
+ value, success := read_input_int(selected_task_row, "Go to:");
if success == false continue;
target_index := clamp(value, 1, MAX_DATABASE_TASKS) - 1;
select_task(db, target_index);