aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-02-01 13:47:36 +1000
committerDavid Walter Seikel2014-02-01 13:47:36 +1000
commitbdbf0fe2ad9249ae6672d4ee8caf0ce73ddca409 (patch)
tree6ed72bc0c35984c94ea38e88a30481e031ed509a
parentRename some keys and remove special casing of MC Esc digit sequences. (diff)
downloadboxes-bdbf0fe2ad9249ae6672d4ee8caf0ce73ddca409.zip
boxes-bdbf0fe2ad9249ae6672d4ee8caf0ce73ddca409.tar.gz
boxes-bdbf0fe2ad9249ae6672d4ee8caf0ce73ddca409.tar.bz2
boxes-bdbf0fe2ad9249ae6672d4ee8caf0ce73ddca409.tar.xz
Check for lone escapes a little differently.
-rw-r--r--handlekeys.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/handlekeys.c b/handlekeys.c
index 030c933..2d30d53 100644
--- a/handlekeys.c
+++ b/handlekeys.c
@@ -185,7 +185,7 @@ void handle_keys(long extra,
185 struct sigaction sigAction, oldSigAction; 185 struct sigaction sigAction, oldSigAction;
186 sigset_t signalMask; 186 sigset_t signalMask;
187 char buffer[20], sequence[20]; 187 char buffer[20], sequence[20];
188 int buffIndex = 0; 188 int buffIndex = 0, pendingEsc = 0;
189 189
190 buffer[0] = 0; 190 buffer[0] = 0;
191 sequence[0] = 0; 191 sequence[0] = 0;
@@ -241,7 +241,7 @@ void handle_keys(long extra,
241 } 241 }
242 else if (0 == p) // A timeout, trigger a time event. 242 else if (0 == p) // A timeout, trigger a time event.
243 { 243 {
244 if ((0 == buffer[1]) && ('\x1B' == buffer[0])) 244 if (pendingEsc)
245 { 245 {
246 // After a short delay to check, this is a real Escape key, 246 // After a short delay to check, this is a real Escape key,
247 // not part of an escape sequence, so deal with it. 247 // not part of an escape sequence, so deal with it.
@@ -287,6 +287,10 @@ void handle_keys(long extra,
287 } 287 }
288 } 288 }
289 289
290 // Check for lone Esc first, wait a bit longer if it is
291 pendingEsc = ((0 == buffer[1]) && ('\x1B' == buffer[0]));
292 if (pendingEsc) continue;
293
290 // Check if it's a CSI before we check for the known key sequences. 294 // Check if it's a CSI before we check for the known key sequences.
291 if ('\x9B' == buffer[0]) 295 if ('\x9B' == buffer[0])
292 csi = 1; 296 csi = 1;