Since moving the cursor is visible if the cursor is visible, added btui_flush() calls after moving the cursor.

This commit is contained in:
Bruce Hill 2020-04-25 18:08:30 -07:00
parent 96336c2b86
commit 81430d869c
2 changed files with 5 additions and 0 deletions

View File

@ -25,6 +25,7 @@ static int Lbtui_enable(lua_State *L)
if (bt == NULL) luaL_error(L, "Not a BTUI object");
*bt = btui_enable();
btui_move_cursor(*bt, 0, 0);
btui_flush(*bt);
return 0;
}
@ -151,6 +152,7 @@ static int Lbtui_move(lua_State *L)
int x = (int)luaL_checkinteger(L, 2);
int y = (int)luaL_checkinteger(L, 3);
btui_move_cursor(*bt, x, y);
btui_flush(*bt);
return 0;
}
@ -345,6 +347,7 @@ static int Lbtui_wrap(lua_State *L)
lua_setmetatable(L, -2);
*bt = btui_enable();
btui_move_cursor(*bt, 0, 0);
btui_flush(*bt);
int status = lua_pcall(L, 1, 0, 0);
btui_disable(*bt);
if (status != LUA_OK)

View File

@ -178,6 +178,7 @@ class BTUI:
def move(self, x, y):
assert self._btui
libbtui.btui_move_cursor(self._btui, int(x), int(y))
libbtui.btui_flush(self._btui)
def hide_cursor(self):
assert self._btui
@ -248,6 +249,7 @@ _btui = BTUI()
@contextmanager
def open_btui():
_btui.enable()
_btui.move(0, 0)
try: yield _btui
finally: _btui.disable()