From b618bfc7cf7eb5fa498a051a17832c2cda4cca9c Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 20 Nov 2021 16:16:00 -0800 Subject: port changes from minimal to maximal version From lcurseslib.c to lcurses/ directory. --- src/lcurses/window.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/lcurses/window.c') diff --git a/src/lcurses/window.c b/src/lcurses/window.c index fd18570..9c243ea 100644 --- a/src/lcurses/window.c +++ b/src/lcurses/window.c @@ -36,8 +36,6 @@ @classmod curses.window */ -//? #include - #include "_helpers.c" #include "chstr.c" @@ -311,10 +309,13 @@ Refresh the window terminal display from the virtual screen. @see curses.doupdate @see noutrefresh */ +extern void draw_menu (lua_State *L); static int Wrefresh(lua_State *L) { - return pushokresult(wrefresh(checkwin(L, 1))); + int result = wrefresh(checkwin(L, 1)); + draw_menu(L); + return pushokresult(result); } @@ -548,6 +549,7 @@ 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; @@ -1302,6 +1304,7 @@ Read a character from the window input. @see curses.echo @see keypad */ +extern void switch_to_editor (lua_State *L, const char *message); static int Wgetch(lua_State *L) { @@ -1310,6 +1313,11 @@ Wgetch(lua_State *L) if (c == ERR) return 0; + if (c == 24) /* ctrl-x */ + exit(0); + if (c == 5) /* ctrl-e */ + switch_to_editor(L, ""); + /* handle other standard menu hotkeys here */ return pushintresult(c); } -- cgit 1.4.1-2-gfad0