diff options
| author | dam <dam@gudinoff> | 2022-11-04 16:48:43 +0000 |
|---|---|---|
| committer | dam <dam@gudinoff> | 2022-11-04 16:48:43 +0000 |
| commit | 9fb461b3f71f13ed782d3d3a06965de686d050c4 (patch) | |
| tree | 7fd438578a8166131909a08560415f4011db9f5c | |
| parent | a22b47e1fbefe73b10eb6f02f0b64a65ce025703 (diff) | |
| download | task-time-tracker-9fb461b3f71f13ed782d3d3a06965de686d050c4.tar.zst task-time-tracker-9fb461b3f71f13ed782d3d3a06965de686d050c4.zip | |
Added some comments to simplify the code.
| -rw-r--r-- | main.c | 44 |
1 files changed, 28 insertions, 16 deletions
@@ -1392,15 +1392,22 @@ int main(int argc, char *argv[]) { } input_pos_x++; - sprintf(string_buffer, "%*s", input_width, ""); - mvaddstr(selected_task_row, input_pos_x, string_buffer); // Get time delta. - echo(); - curs_set(1); - mvgetnstr(selected_task_row, input_pos_x, string_buffer, input_width); - noecho(); - curs_set(0); + // TODO Maybe use that function referred in 'g' here? + { + attron(A_UNDERLINE); + + sprintf(string_buffer, "%*s", input_width, ""); + mvaddstr(selected_task_row, input_pos_x, string_buffer); + + echo(); + curs_set(1); + mvgetnstr(selected_task_row, input_pos_x, string_buffer, input_width); + noecho(); + curs_set(0); + attroff(A_UNDERLINE); + } attrset(A_NORMAL); @@ -1558,17 +1565,22 @@ int main(int argc, char *argv[]) { move(selected_task_row, 1); addch(ACS_CKBOARD); addstr(" Go to: "); - int input_pos_x = getcurx(stdscr); - sprintf(string_buffer, "%*s", size_x - input_pos_x - 1, ""); - attron(A_UNDERLINE); - addstr(string_buffer); // Get line number. - echo(); - curs_set(1); - mvgetnstr(selected_task_row, input_pos_x, string_buffer, size_x - input_pos_x - 1); - noecho(); - curs_set(0); + // TODO Maybe convert this code block on a function? + { + int input_pos_x = getcurx(stdscr); + sprintf(string_buffer, "%*s", size_x - input_pos_x - 1, ""); + attron(A_UNDERLINE); + addstr(string_buffer); + + echo(); + curs_set(1); + mvgetnstr(selected_task_row, input_pos_x, string_buffer, size_x - input_pos_x - 1); + noecho(); + curs_set(0); + attroff(A_UNDERLINE); + } attrset(A_NORMAL); |
