fix(ui): gate redraw on suspend flag to stop bleed-through over editor
The editor rewrite (async g_child_watch) dropped the background_mode guard that paused the main loop while an external editor (e.g. nano) runs. ui_update/ui_resize/ui_redraw instead self-guarded on isendwin(), which is unreliable: any doupdate() during the editor session (e.g. the readline redisplay after the alt+c keypress) clears it, after which the ~10Hz main-loop ui_update() repaints the status bar, chat window and input pad over the editor. The most visible artifact is the per-minute status-bar clock digit bleeding through onto the editor screen. Track suspension explicitly with a ui_suspended flag set in ui_suspend()/ui_resume() and gate ui_update/ui_resize/ui_redraw on it (kept alongside isendwin() for the shutdown/closed-screen case). The flag stays TRUE for the whole editor session regardless of isendwin flapping, so nothing repaints over the editor.
This commit is contained in:
@@ -54,6 +54,7 @@
|
||||
|
||||
static int inp_size;
|
||||
static gboolean perform_resize = FALSE;
|
||||
static gboolean ui_suspended = FALSE;
|
||||
static GTimer* ui_idle_time;
|
||||
static WINDOW* main_scr;
|
||||
|
||||
@@ -63,6 +64,14 @@ static Display* display;
|
||||
|
||||
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).
|
||||
static gboolean
|
||||
_ui_redraw_suspended(void)
|
||||
{
|
||||
return ui_suspended || isendwin();
|
||||
}
|
||||
|
||||
static void
|
||||
_ui_close(void)
|
||||
{
|
||||
@@ -120,8 +129,7 @@ ui_sigwinch_handler(int sig)
|
||||
void
|
||||
ui_update(void)
|
||||
{
|
||||
// UI is suspended
|
||||
if (isendwin()) {
|
||||
if (_ui_redraw_suspended()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -179,6 +187,7 @@ ui_reset_idle_time(void)
|
||||
void
|
||||
ui_suspend(void)
|
||||
{
|
||||
ui_suspended = TRUE;
|
||||
inp_suspend();
|
||||
endwin();
|
||||
}
|
||||
@@ -186,6 +195,7 @@ ui_suspend(void)
|
||||
void
|
||||
ui_resume(void)
|
||||
{
|
||||
ui_suspended = FALSE;
|
||||
refresh();
|
||||
inp_resume();
|
||||
}
|
||||
@@ -193,8 +203,7 @@ ui_resume(void)
|
||||
void
|
||||
ui_resize(void)
|
||||
{
|
||||
// UI is suspended
|
||||
if (isendwin()) {
|
||||
if (_ui_redraw_suspended()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -216,8 +225,7 @@ ui_resize(void)
|
||||
void
|
||||
ui_redraw(void)
|
||||
{
|
||||
// UI is suspended
|
||||
if (isendwin()) {
|
||||
if (_ui_redraw_suspended()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user