fix(ui): stop status bar / chat bleed-through over the external editor #131

Closed
jabber.developer2 wants to merge 11 commits from fix/editor-ui-suspend-redraw into master
7 changed files with 62 additions and 15 deletions
Showing only changes of commit 394df6d391 - Show all commits

View File

@@ -54,6 +54,7 @@
static int inp_size; static int inp_size;
static gboolean perform_resize = FALSE; static gboolean perform_resize = FALSE;
static gboolean ui_suspended = FALSE;
static GTimer* ui_idle_time; static GTimer* ui_idle_time;
static WINDOW* main_scr; static WINDOW* main_scr;
@@ -63,6 +64,16 @@ static Display* display;
static void _ui_draw_term_title(void); static void _ui_draw_term_title(void);
// Skip drawing while an external editor is active (ui_suspended) or after the
// screen has been closed (endwin). The flag is authoritative and does not rely
// on isendwin() staying TRUE, which a stray doupdate() during the session could
// otherwise clear.
static gboolean
_ui_redraw_suspended(void)
{
return ui_suspended || isendwin();
}
static void static void
_ui_close(void) _ui_close(void)
{ {
@@ -120,8 +131,7 @@ ui_sigwinch_handler(int sig)
void void
ui_update(void) ui_update(void)
{ {
// UI is suspended if (_ui_redraw_suspended()) {
if (isendwin()) {
return; return;
} }
@@ -179,6 +189,7 @@ ui_reset_idle_time(void)
void void
ui_suspend(void) ui_suspend(void)
{ {
ui_suspended = TRUE;
inp_suspend(); inp_suspend();
doupdate(); doupdate();
endwin(); endwin();
@@ -187,6 +198,7 @@ ui_suspend(void)
void void
ui_resume(void) ui_resume(void)
{ {
ui_suspended = FALSE;
refresh(); refresh();
inp_resume(); inp_resume();
} }
@@ -210,8 +222,7 @@ ui_flash(void)
void void
ui_resize(void) ui_resize(void)
{ {
// UI is suspended if (_ui_redraw_suspended()) {
if (isendwin()) {
return; return;
} }
@@ -233,8 +244,7 @@ ui_resize(void)
void void
ui_redraw(void) ui_redraw(void)
{ {
// UI is suspended if (_ui_redraw_suspended()) {
if (isendwin()) {
return; return;
} }