print key bindings on the footer

This commit is contained in:
Zvonimir Rudinski
2024-06-02 05:59:43 +02:00
parent b73e47e590
commit 758300b704

8
main.c
View File

@@ -17,6 +17,7 @@
#define COMPLETED_PAIR 3
#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] = "";
TodoItem *todos = NULL;
@@ -94,11 +95,14 @@ void draw_footer(int width, int height) {
// print the string
printw("%d/%d", marked_count, todos_count);
// print the rest of the line
for (int i = length; i < width - 1; i++) {
// print the rest of the line but leave space for the key bindings
for (unsigned long i = length; i < width - strlen(KEY_BINDINGS) - 1; i++) {
addch(' ');
}
// print the key bindings
printw(KEY_BINDINGS);
attroff(COLOR_PAIR(BORDERS_PAIR));
}