print key bindings on the footer

This commit is contained in:
2024-06-02 05:59:43 +02:00
parent 0cf3febd2b
commit 613071c8f5

8
main.c
View File

@@ -17,6 +17,7 @@
#define COMPLETED_PAIR 3 #define COMPLETED_PAIR 3
#include "3rd-party/stb-ds.h" #include "3rd-party/stb-ds.h"
#define KEY_BINDINGS " [a]dd [m]ark [d]elete [w]rite [l]oad [q]uit"
char SAVE_FILE[MAX_PATH_LENGTH] = ""; char SAVE_FILE[MAX_PATH_LENGTH] = "";
TodoItem *todos = NULL; TodoItem *todos = NULL;
@@ -94,11 +95,14 @@ void draw_footer(int width, int height) {
// print the string // print the string
printw("%d/%d", marked_count, todos_count); printw("%d/%d", marked_count, todos_count);
// print the rest of the line // print the rest of the line but leave space for the key bindings
for (int i = length; i < width - 1; i++) { for (unsigned long i = length; i < width - strlen(KEY_BINDINGS) - 1; i++) {
addch(' '); addch(' ');
} }
// print the key bindings
printw(KEY_BINDINGS);
attroff(COLOR_PAIR(BORDERS_PAIR)); attroff(COLOR_PAIR(BORDERS_PAIR));
} }