From f5fdc853245c5c7f103caee0af96aba2dc054090 Mon Sep 17 00:00:00 2001 From: "jabber.developer2" Date: Wed, 27 May 2026 16:19:34 +0300 Subject: [PATCH] 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. --- src/ui/core.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/ui/core.c b/src/ui/core.c index f755cfa9..4ddfe4bb 100644 --- a/src/ui/core.c +++ b/src/ui/core.c @@ -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; @@ -120,8 +121,8 @@ ui_sigwinch_handler(int sig) void ui_update(void) { - // UI is suspended - if (isendwin()) { + // UI is suspended (editor active) or the screen is closed + if (ui_suspended || isendwin()) { return; } @@ -179,6 +180,7 @@ ui_reset_idle_time(void) void ui_suspend(void) { + ui_suspended = TRUE; inp_suspend(); endwin(); } @@ -186,6 +188,7 @@ ui_suspend(void) void ui_resume(void) { + ui_suspended = FALSE; refresh(); inp_resume(); } @@ -193,8 +196,8 @@ ui_resume(void) void ui_resize(void) { - // UI is suspended - if (isendwin()) { + // UI is suspended (editor active) or the screen is closed + if (ui_suspended || isendwin()) { return; } @@ -216,8 +219,8 @@ ui_resize(void) void ui_redraw(void) { - // UI is suspended - if (isendwin()) { + // UI is suspended (editor active) or the screen is closed + if (ui_suspended || isendwin()) { return; }