diff --git a/Lua/lbtui.c b/Lua/lbtui.c index 37d0862..0d227a2 100644 --- a/Lua/lbtui.c +++ b/Lua/lbtui.c @@ -25,7 +25,6 @@ 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; } @@ -131,6 +130,7 @@ static int Lbtui_hidecursor(lua_State *L) btui_t **bt = (btui_t**)lua_touserdata(L, 1); if (bt == NULL) luaL_error(L, "Not a BTUI object"); btui_hide_cursor(*bt); + btui_flush(*bt); return 0; } @@ -139,6 +139,7 @@ static int Lbtui_showcursor(lua_State *L) btui_t **bt = (btui_t**)lua_touserdata(L, 1); if (bt == NULL) luaL_error(L, "Not a BTUI object"); btui_show_cursor(*bt); + btui_flush(*bt); return 0; } @@ -150,7 +151,6 @@ 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; } @@ -203,6 +203,7 @@ static int Lbtui_linebox(lua_State *L) int w = (int)luaL_checkinteger(L, 4); int h = (int)luaL_checkinteger(L, 5); btui_draw_linebox(*bt, x, y, w, h); + btui_flush(*bt); return 0; } @@ -215,6 +216,7 @@ static int Lbtui_fillbox(lua_State *L) int w = (int)luaL_checkinteger(L, 4); int h = (int)luaL_checkinteger(L, 5); btui_fill_box(*bt, x, y, w, h); + btui_flush(*bt); return 0; } @@ -227,6 +229,7 @@ static int Lbtui_shadow(lua_State *L) int w = (int)luaL_checkinteger(L, 4); int h = (int)luaL_checkinteger(L, 5); btui_draw_shadow(*bt, x, y, w, h); + btui_flush(*bt); return 0; } @@ -238,6 +241,7 @@ static int Lbtui_scroll(lua_State *L) int lastline = (int)luaL_checkinteger(L, 3); int scroll = (int)luaL_checkinteger(L, 4); btui_scroll(*bt, firstline, lastline, scroll); + btui_flush(*bt); return 0; } diff --git a/Python/btui.py b/Python/btui.py index de8a81d..735a4a8 100644 --- a/Python/btui.py +++ b/Python/btui.py @@ -123,6 +123,7 @@ class BTUI: raise ArgumentError("Not a supported clear type: "+repr(mode)) clr = ctypes.c_uint.in_dll(libbtui, 'BTUI_CLEAR_' + mode.upper()) libbtui.btui_clear(self._btui, clr) + libbtui.btui_flush(self._btui) def disable(self): libbtui.btui_disable(self._btui) @@ -136,6 +137,7 @@ class BTUI: def draw_shadow(self, x, y, w, h): assert self._btui libbtui.btui_draw_shadow(self._btui, int(x), int(y), int(w), int(h)) + libbtui.btui_flush(self._btui) def enable(self): self._btui = libbtui.btui_enable() @@ -149,6 +151,7 @@ class BTUI: def fill_box(self, x, y, w, h): assert self._btui libbtui.btui_fill_box(self._btui, int(x), int(y), int(w), int(h)) + libbtui.btui_flush(self._btui) def flush(self): assert self._btui @@ -179,14 +182,17 @@ class BTUI: def hide_cursor(self): assert self._btui libbtui.btui_hide_cursor(self._btui) + libbtui.btui_flush(self._btui) def show_cursor(self): assert self._btui libbtui.btui_show_cursor(self._btui) + libbtui.btui_flush(self._btui) def outline_box(self, x, y, w, h): assert self._btui libbtui.btui_draw_linebox(self._btui, int(x), int(y), int(w), int(h)) + libbtui.btui_flush(self._btui) def scroll(self, firstline, lastline=None, amount=None): assert self._btui @@ -194,6 +200,7 @@ class BTUI: amount = firstline firstline, lastline = 1, self.height libbtui.btui_scroll(self._btui, firstline, lastline, amount) + libbtui.btui_flush(self._btui) def set_attributes(self, *attrs): assert self._btui @@ -234,6 +241,7 @@ class BTUI: def write_bytes(self, b): assert self._btui libbtui.btui_puts(self._btui, b) + libbtui.btui_flush(self._btui) _btui = BTUI() diff --git a/btui.h b/btui.h index 1ab72ca..1dc33e7 100644 --- a/btui.h +++ b/btui.h @@ -399,7 +399,6 @@ void btui_draw_linebox(btui_t *bt, int x, int y, int w, int h) for (int i = 0; i < w; i++) fputc('q', bt->out); fputs("j\033(B", bt->out); - fflush(bt->out); } /* @@ -417,7 +416,6 @@ void btui_draw_shadow(btui_t *bt, int x, int y, int w, int h) fputc('a', bt->out); } fputs("\033(B", bt->out); - fflush(bt->out); } /* @@ -471,7 +469,6 @@ void btui_fill_box(btui_t *bt, int x, int y, int w, int h) fputc(' ', bt->out); } } - fflush(bt->out); } /* @@ -707,7 +704,6 @@ int btui_hide_cursor(btui_t *bt) int btui_puts(btui_t *bt, const char *s) { int ret = fputs(s, bt->out); - fflush(bt->out); return ret; }