refactor(ui): centralize physical paint through prof_doupdate()
All checks were successful
CI Code / Check spelling (pull_request) Successful in 18s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Linux (debian) (pull_request) Successful in 4m57s
CI Code / Linux (ubuntu) (pull_request) Successful in 5m0s
CI Code / Linux (arch) (pull_request) Successful in 5m46s
CI Code / Code Coverage (pull_request) Successful in 7m3s
All checks were successful
CI Code / Check spelling (pull_request) Successful in 18s
CI Code / Check coding style (pull_request) Successful in 32s
CI Code / Linux (debian) (pull_request) Successful in 4m57s
CI Code / Linux (ubuntu) (pull_request) Successful in 5m0s
CI Code / Linux (arch) (pull_request) Successful in 5m46s
CI Code / Code Coverage (pull_request) Successful in 7m3s
Upstream's "guard terminal writes while suspended" fix and commit 2 of this branch both work by sprinkling `if (!isendwin())` (or `!is_suspended && !isendwin()`) guards around every doupdate() reachable during a suspended session. That keeps isendwin() a valid signal but turns the no-stray-write invariant into a whitelist: every new doupdate / refresh / wrefresh added later in src/ has to remember the guard, and the original bug class came from exactly such an oversight in _inp_write. Introduce a single primitive, prof_doupdate(), that flushes only when not suspended (via the existing _ui_redraw_suspended() helper). Replace every direct doupdate() in src/ui/inputwin.c (inp_get_line, inp_get_password, _inp_write) and the trailing doupdate in ui_update with the wrapper, collapsing their inline guards. ui_suspend() now flushes via prof_doupdate() before flipping ui_suspended, so upstream's pre-endwin flush is preserved. The flag-based gate in ui_update / ui_resize / ui_redraw is kept as belt-and-suspenders: even if a future raw doupdate slips in elsewhere, ui_update has not been refreshing the virtual screen, so the blit finds stale content rather than a fresh status-bar clock or chat line.
This commit is contained in:
@@ -148,7 +148,7 @@ ui_update(void)
|
||||
title_bar_update_virtual();
|
||||
status_bar_draw();
|
||||
inp_put_back();
|
||||
doupdate();
|
||||
prof_doupdate();
|
||||
|
||||
if (perform_resize) {
|
||||
perform_resize = FALSE;
|
||||
@@ -189,9 +189,10 @@ ui_reset_idle_time(void)
|
||||
void
|
||||
ui_suspend(void)
|
||||
{
|
||||
ui_suspended = TRUE;
|
||||
inp_suspend();
|
||||
doupdate();
|
||||
// Flush before flipping the flag (prof_doupdate skips while suspended).
|
||||
prof_doupdate();
|
||||
ui_suspended = TRUE;
|
||||
endwin();
|
||||
}
|
||||
|
||||
@@ -219,6 +220,14 @@ ui_flash(void)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
prof_doupdate(void)
|
||||
{
|
||||
if (!_ui_redraw_suspended()) {
|
||||
doupdate();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
ui_resize(void)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user