From: Mark Jamsek Subject: tog: use wtimeout(3) instead of nodelay(3) in view loop To: gameoftrees@openbsd.org Date: Thu, 26 Dec 2024 01:36:47 +1100 This simple one line change is a fix needed for an upcoming diff. We currently use nodelay(3) in the view loop, but this disables the half-delay mode which we set to a 1 second refresh rate after an initial fast initialisation at startup. This can break displaying status updates in some cases, which I discovered when cooking the next diff to make the selection of ref view tags that point to non-commit objects non-fatal, and to enable selecting nested tags from the ref view that resolve to a commit. commit cfe9343a9f6a872cd65b1086e6dab68010b19d98 from: Mark Jamsek date: Wed Dec 25 13:57:30 2024 UTC tog: respect fast refresh state in view loop nodelay(3) makes our getch(3) calls non-blocking and disables half-delay mode in the view loop, which is set to 1 second intervals after the initial fast initialisation at startup. This makes the view refresh with no delay (i.e., every 100 milliseconds) irrespective of whether we are in the fast initialisation phase. Use wtimeout(3) instead so we honour the desired refresh rate. M tog/tog.c | 1+ 1- 1 file changed, 1 insertion(+), 1 deletion(-) commit - 589b5832ea0e12318af1af49fb76e2887629e2b6 commit + cfe9343a9f6a872cd65b1086e6dab68010b19d98 blob - fb50d0d367f8c852aed59a901ac3a658197a647e blob + 7dd3a24c5a2515f0073943bd56830d25bf86f45a --- tog/tog.c +++ tog/tog.c @@ -1822,7 +1822,7 @@ view_input(struct tog_view **new, int *done, struct to } if (view->hiline && ch != ERR && ch != 0) view->hiline = 0; /* key pressed, clear line highlight */ - nodelay(view->window, TRUE); + wtimeout(view->window, fast_refresh ? 100 : 1000); /* milliseconds */ errcode = pthread_mutex_lock(&tog_mutex); if (errcode) return got_error_set_errno(errcode, "pthread_mutex_lock"); -- Mark Jamsek GPG: F2FF 13DE 6A06 C471 CA80 E6E2 2930 DC66 86EE CF68