aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorRobin Haberkorn <rhaberkorn@fmsbw.de>2026-01-03 23:44:36 +0300
committerRobin Haberkorn <rhaberkorn@fmsbw.de>2026-01-03 23:44:36 +0300
commitc825c2fd4441ac29f6775ef5bed4143d03da3c97 (patch)
treea72ea277c4d525d7f56c1d41dd433f833767a8b3 /src
parent0236c1ee6244700db907d7dcabde301916f90cda (diff)
Curses: use wtimeout() consistently instead of nodelay() and halfdelay()
* Fixes input hangs on PDCursesMod/WinGUI, where we depend on polling for CTRL+C. * ncurses apparently does not need this workaround as it treats all of the aforementioned calls as equivalent.
Diffstat (limited to 'src')
-rw-r--r--src/interface-curses/interface.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/interface-curses/interface.c b/src/interface-curses/interface.c
index b1c806f..010515c 100644
--- a/src/interface-curses/interface.c
+++ b/src/interface-curses/interface.c
@@ -812,7 +812,7 @@ teco_interface_init_interactive(GError **error)
* must always be TRUE so we receive KEY_RESIZE.
*/
keypad(teco_interface.input_pad, TRUE);
- nodelay(teco_interface.input_pad, TRUE);
+ wtimeout(teco_interface.input_pad, 0);
teco_interface.input_queue = g_queue_new();
@@ -1425,7 +1425,7 @@ teco_interface_osc52_get_clipboard(const gchar *name, gchar **str, gsize *len, G
* We restore all changed Curses settings before returning
* to be on the safe side.
*/
- halfdelay(1); /* 100ms timeout */
+ wtimeout(teco_interface.input_pad, 100);
/* don't interpret escape sequences */
keypad(teco_interface.input_pad, FALSE);
@@ -1492,7 +1492,7 @@ teco_interface_osc52_get_clipboard(const gchar *name, gchar **str, gsize *len, G
cleanup:
keypad(teco_interface.input_pad, TRUE);
- nodelay(teco_interface.input_pad, TRUE);
+ wtimeout(teco_interface.input_pad, 0);
return ret;
}
@@ -2015,7 +2015,6 @@ teco_interface_blocking_getch(void)
/* no special <CTRL/C> handling */
raw();
- nodelay(teco_interface.input_pad, FALSE);
/*
* Make sure we return when it's time to create recovery dumps.
@@ -2026,6 +2025,8 @@ teco_interface_blocking_getch(void)
gdouble elapsed = g_timer_elapsed(teco_interface.recovery_timer, NULL);
wtimeout(teco_interface.input_pad,
MAX((gdouble)teco_ring_recovery_interval - elapsed, 0)*1000);
+ } else {
+ wtimeout(teco_interface.input_pad, -1);
}
/*
@@ -2037,7 +2038,7 @@ teco_interface_blocking_getch(void)
teco_memory_start_limiting();
/* allow asynchronous interruptions on <CTRL/C> */
teco_interrupted = FALSE;
- nodelay(teco_interface.input_pad, TRUE);
+ wtimeout(teco_interface.input_pad, 0);
#if defined(CURSES_TTY) || defined(PDCURSES_WINCON) || defined(NCURSES_WIN32)
noraw(); /* FIXME: necessary because of NCURSES_WIN32 bug */
cbreak();