about summary refs log tree commit diff stats
path: root/src/lcurseslib.c
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-11-05 18:27:32 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-11-05 18:43:37 -0700
commitcab996b1941014b78bdfafb1e6d20e159e035f53 (patch)
treef9b2c06b55c9cdd8647a575b5f17c4732ee733c0 /src/lcurseslib.c
parent78898d271620ee15ac576f157ca2e942420421fb (diff)
downloadteliva-cab996b1941014b78bdfafb1e6d20e159e035f53.tar.gz
make some space for the global menu
We'll eventually need some interface to add entries to it.
Diffstat (limited to 'src/lcurseslib.c')
-rw-r--r--src/lcurseslib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/lcurseslib.c b/src/lcurseslib.c
index e58a5cc..938ebed 100644
--- a/src/lcurseslib.c
+++ b/src/lcurseslib.c
@@ -8,8 +8,21 @@
 #include "lualib.h"
 
 
+void draw_menu (void) {
+  attron(A_BOLD|A_REVERSE);
+  for (int x = 0; x < COLS; ++x)
+    mvaddch(LINES-1, x, ' ');
+  attroff(A_REVERSE);
+  mvaddstr(LINES-1, 2, " ^e ");
+  attron(A_REVERSE);
+  mvaddstr(LINES-1, 6, " edit ");
+  attroff(A_BOLD|A_REVERSE);
+}
+
+
 static int Prefresh (lua_State *L) {
   refresh();
+  draw_menu();
   return 1;
 }
 
@@ -23,6 +36,7 @@ static int Pstdscr (lua_State *L) {
 
 static int Pgetch (lua_State *L) {
   int c = wgetch(stdscr);
+  // TODO: handle menu here
   if (c == ERR)
     return 0;
   lua_pushinteger(L, c);
@@ -159,6 +173,7 @@ static int Wgetmaxyx (lua_State *L) {
   WINDOW *w = checkwin(L, 1);
   int y, x;
   getmaxyx(w, y, x);
+  --y;  // set aside space for the menu bar
   lua_pushinteger(L, y);
   lua_pushinteger(L, x);
   return 2;