Make "old esc mode" key timeout configurable



Hello,

I use "old ESC mode" where single ESC works after a delay.

I patched mc to look at KEYBOARD_KEY_TIMEOUT_US environment variable 
so that delay is configurable (instead of hardcoded 0.5 second one).

25 millisecond timeout works just fine on local ttys, serial lines,
and over ssh. So I am setting KEYBOARD_KEY_TIMEOUT_US=25000 in my
login scripts.

Patch is run tested for at two years now.
Please apply.
--
vda
diff -urp mc-4.6.0.orig/src/key.c mc-4.6.0/src/key.c
--- mc-4.6.0.orig/src/key.c	Tue Jan 28 00:37:56 2003
+++ mc-4.6.0/src/key.c	Sat Oct 23 21:04:33 2004
@@ -58,7 +58,7 @@
 			 (t2.tv_usec-t1.tv_usec)/1000)
 			 
 /* timeout for old_esc_mode in usec */
-#define ESCMODE_TIMEOUT 1000000
+#define ESCMODE_TIMEOUT keyboard_key_timeout
 
 /* Linux console keyboard modifiers */
 #define SHIFT_PRESSED 1
@@ -70,6 +70,7 @@
 int mou_auto_repeat = 100;
 int double_click_speed = 250;
 int old_esc_mode = 0;
+int keyboard_key_timeout = 1000000;	/* settable via env */
 
 int use_8th_bit_as_meta = 1;
 
@@ -256,6 +257,10 @@ static Window x11_window;
 void init_key (void)
 {
     char *term = (char *) getenv ("TERM");
+    
+    char *kt = (char *)getenv("KEYBOARD_KEY_TIMEOUT_US");
+    if (kt != NULL)
+	keyboard_key_timeout = atoi(kt);
     
     /* This has to be the first define_sequence */
     /* So, we can assume that the first keys member has ESC */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]