dvtm

dynamic virtual terminal manager - with my changes
git clone https://pi.duncano.de/git/dvtm.git
Log | Files | Refs | README | LICENSE

commit a107d39d954d7134437971f3c352b45c59e039e5
parent df665efcf62a87243779018b68e5f16d408b0c7c
Author: Marc Andre Tanner <mat@brain-dump.org>
Date:   Mon, 26 Jan 2009 00:52:36 +0100

Reduce latency on some keystrokes due to ncurses internal timer

Set the delay ncurses waits to determine whether a keystroke
is part of an escape sequence or not to 100ms instead of the
default 1000ms. This delay is painful in some cases, like
using Alt-2 in urxvt, which happens to be treated as part of
an escape sequence by curses, thus waits a full second to see
if something else happens.

The delay can now be set via the -d commandline switch.

Based on a patch from Pierre Habouzit, originally reported
as debian bug #512544

Diffstat:
dvtm.1 | 4++++
dvtm.c | 11++++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dvtm.1 b/dvtm.1 @@ -16,6 +16,10 @@ prints version information to standard output, then exits. .B \-m mod set default modifier at runtime. .TP +.B \-d escdelay +set the delay ncurses waits before deciding if a character that might be part +of an escape sequence is actually part of an escape sequence. +.TP .B \-h nnn set the scrollback history buffer size at runtime. .TP diff --git a/dvtm.c b/dvtm.c @@ -161,6 +161,7 @@ static const char *shell; static bool need_screen_resize = true; static int width, height, scroll_buf_size = SCROLL_BUF_SIZE; static bool running = true; +static int esc_delay = 100; #ifdef CONFIG_MOUSE # include "mouse.c" @@ -838,6 +839,7 @@ setup() { signal(SIGWINCH, sigwinch_handler); signal(SIGCHLD, sigchld_handler); signal(SIGTERM, sigterm_handler); + set_escdelay(esc_delay); } static void @@ -864,7 +866,7 @@ quit(const char *args[]) { static void usage() { cleanup(); - eprint("usage: dvtm [-v] [-m mod] [-h n] " + eprint("usage: dvtm [-v] [-m mod] [-d escdelay] [-h n] " #ifdef CONFIG_STATUSBAR "[-s status-fifo] " #endif @@ -920,6 +922,13 @@ parse_args(int argc, char *argv[]) { keys[i].mod = *mod; break; } + case 'd': + esc_delay = atoi(argv[++arg]); + if (esc_delay < 50) + esc_delay = 50; + else if (esc_delay > 1000) + esc_delay = 1000; + break; case 'h': scroll_buf_size = atoi(argv[++arg]); break;