From 758300b70465f09e7e82d4bec20d6842c538e84c Mon Sep 17 00:00:00 2001 From: Zvonimir Rudinski Date: Sun, 2 Jun 2024 05:59:43 +0200 Subject: [PATCH] print key bindings on the footer --- main.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/main.c b/main.c index 4611db7..ce8f548 100644 --- a/main.c +++ b/main.c @@ -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)); }