aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/boxes.c
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-01-27 21:52:07 +1000
committerDavid Walter Seikel2014-01-27 21:52:07 +1000
commite8685a0fdb413b1b20c3fb08096ec4102f5a578c (patch)
tree37287646a68d23fcc2886875e6346096297caeb8 /boxes.c
parentChoose a new control key for box splitting in MC. Ctrl-o is in use. (diff)
downloadboxes-e8685a0fdb413b1b20c3fb08096ec4102f5a578c.zip
boxes-e8685a0fdb413b1b20c3fb08096ec4102f5a578c.tar.gz
boxes-e8685a0fdb413b1b20c3fb08096ec4102f5a578c.tar.bz2
boxes-e8685a0fdb413b1b20c3fb08096ec4102f5a578c.tar.xz
Sort the keys array by type, purely for reference.
Diffstat (limited to '')
-rw-r--r--boxes.c133
1 files changed, 72 insertions, 61 deletions
diff --git a/boxes.c b/boxes.c
index b347a3f..50853f6 100644
--- a/boxes.c
+++ b/boxes.c
@@ -296,19 +296,52 @@ struct key
296}; 296};
297 297
298// This table includes some variations I have found on some terminals, and the MC "Esc digit" versions. 298// This table includes some variations I have found on some terminals, and the MC "Esc digit" versions.
299// NOTE - The MC Esc variations might not be such a good idea, other programs want the Esc key for other things.
300// Notably seems that "Esc somekey" is used in place of "Alt somekey" AKA "Meta somekey" coz apparently some OSes swallow those.
301// Conversely, some terminals send "Esc somekey" when you do "Alt somekey".
302// Those MC Esc variants might be used on Macs for other things?
303// TODO - Don't think I got all the linux console variations. 299// TODO - Don't think I got all the linux console variations.
304// TODO - tmux messes with the shift function keys somehow.
305// TODO - Add more shift variations, plus Ctrl & Alt variations. 300// TODO - Add more shift variations, plus Ctrl & Alt variations.
301// TODO - tmux messes with the shift function keys somehow.
306// TODO - Add other miscelany that does not use an escape sequence. Including mouse events. 302// TODO - Add other miscelany that does not use an escape sequence. Including mouse events.
307// TODO - Perhaps sort this for quicker searching, OR to say which terminal is which, though there is some overlap. 303
308// On the other hand, simple wins out over speed, and sorting by terminal type wins the simple test. 304// This is sorted to say which terminal is which, though there is some overlap.
309// Plus, human typing speeds wont need binary searching speeds on this small table. 305// Human typing speeds wont need binary searching speeds on this small table.
306// So simple wins out over speed, and sorting by terminal type wins the simple test.
310struct key keys[] = 307struct key keys[] =
311{ 308{
309 // Control characters.
310// {"\x00", "^@"}, // NUL Commented out coz it's the C string terminator, and may confuse things.
311 {"\x01", "^A"}, // SOH
312 {"\x02", "^B"}, // STX
313 {"\x03", "^C"}, // ETX SIGTERM
314 {"\x04", "^D"}, // EOT
315 {"\x05", "^E"}, // ENQ
316 {"\x06", "^F"}, // ACK
317 {"\x07", "^G"}, // BEL
318 {"\x08", "Del"}, // BS Delete key, usually.
319 {"\x09", "Tab"}, // HT Tab key.
320 {"\x0A", "Return"}, // LF Return key. Roxterm at least is translating both Ctrl-J and Ctrl-M into this.
321 {"\x0B", "^K"}, // VT
322 {"\x0C", "^L"}, // FF
323 {"\x0D", "^M"}, // CR Other Return key, usually.
324 {"\x0E", "^N"}, // SO
325 {"\x0F", "^O"}, // SI
326 {"\x10", "^P"}, // DLE
327 {"\x11", "^Q"}, // DC1
328 {"\x12", "^R"}, // DC2
329 {"\x13", "^S"}, // DC3
330 {"\x14", "^T"}, // DC4
331 {"\x15", "^U"}, // NAK
332 {"\x16", "^V"}, // SYN
333 {"\x17", "^W"}, // ETB
334 {"\x18", "^X"}, // CAN
335 {"\x19", "^Y"}, // EM
336 {"\x1A", "^Z"}, // SUB
337// {"\x1B", "^["}, // ESC Esc key. Commented out coz it's the ANSI start byte in the above multibyte keys. Handled in the code with a timeout.
338 {"\x1C", "^\\"}, // FS SIGQUIT
339 {"\x1D", "^]"}, // GS
340 {"\x1E", "^^"}, // RS
341 {"\x1F", "^_"}, // US
342 {"\x7f", "BS"}, // Backspace key, usually. Ctrl-? perhaps?
343
344 // TODO - sort these into terminal types, just for reference.
312 {"\x1B[3~", "Del"}, 345 {"\x1B[3~", "Del"},
313 {"\x1B[2~", "Ins"}, 346 {"\x1B[2~", "Ins"},
314 {"\x1B[D", "Left"}, 347 {"\x1B[D", "Left"},
@@ -333,43 +366,38 @@ struct key keys[] =
333 {"\x1B[5~", "PgUp"}, 366 {"\x1B[5~", "PgUp"},
334 {"\x1B[6~", "PgDn"}, 367 {"\x1B[6~", "PgDn"},
335 {"\x1B\x4F\x50", "F1"}, 368 {"\x1B\x4F\x50", "F1"},
336 {"\x1B[11~", "F1"},
337 {"\x1B\x31", "F1"},
338 {"\x1BOP", "F1"},
339 {"\x1B\x4F\x51", "F2"}, 369 {"\x1B\x4F\x51", "F2"},
340 {"\x1B[12~", "F2"},
341 {"\x1B\x32", "F2"},
342 {"\x1BOO", "F2"},
343 {"\x1B\x4F\x52", "F3"}, 370 {"\x1B\x4F\x52", "F3"},
344 {"\x1B[13~", "F3"},
345 {"\x1B\x33~", "F3"},
346 {"\x1BOR", "F3"},
347 {"\x1B\x4F\x53", "F4"}, 371 {"\x1B\x4F\x53", "F4"},
348 {"\x1B[14~", "F4"}, 372
349 {"\x1B\x34", "F4"}, 373 {"\x1BOP", "F1"},
374 {"\x1BOO", "F2"},
375 {"\x1BOR", "F3"},
350 {"\x1BOS", "F4"}, 376 {"\x1BOS", "F4"},
377
378 {"\x1B[11~", "F1"},
379 {"\x1B[12~", "F2"},
380 {"\x1B[13~", "F3"},
381 {"\x1B[14~", "F4"},
351 {"\x1B[15~", "F5"}, 382 {"\x1B[15~", "F5"},
352 {"\x1B\x35", "F5"},
353 {"\x1B[17~", "F6"}, 383 {"\x1B[17~", "F6"},
354 {"\x1B\x36", "F6"},
355 {"\x1B[18~", "F7"}, 384 {"\x1B[18~", "F7"},
356 {"\x1B\x37", "F7"},
357 {"\x1B[19~", "F8"}, 385 {"\x1B[19~", "F8"},
358 {"\x1B\x38", "F8"},
359 {"\x1B[20~", "F9"}, 386 {"\x1B[20~", "F9"},
360 {"\x1B\x39", "F9"},
361 {"\x1B[21~", "F10"}, 387 {"\x1B[21~", "F10"},
362 {"\x1B\x30", "F10"},
363 {"\x1B[23~", "F11"}, 388 {"\x1B[23~", "F11"},
364 {"\x1B[24~", "F12"}, 389 {"\x1B[24~", "F12"},
390
365 {"\x1B\x4f\x31;2P", "Shift F1"}, 391 {"\x1B\x4f\x31;2P", "Shift F1"},
366 {"\x1B[1;2P", "Shift F1"},
367 {"\x1B\x4f\x31;2Q", "Shift F2"}, 392 {"\x1B\x4f\x31;2Q", "Shift F2"},
368 {"\x1B[1;2Q", "Shift F2"},
369 {"\x1B\x4f\x31;2R", "Shift F3"}, 393 {"\x1B\x4f\x31;2R", "Shift F3"},
370 {"\x1B[1;2R", "Shift F3"},
371 {"\x1B\x4f\x31;2S", "Shift F4"}, 394 {"\x1B\x4f\x31;2S", "Shift F4"},
395
396 {"\x1B[1;2P", "Shift F1"},
397 {"\x1B[1;2Q", "Shift F2"},
398 {"\x1B[1;2R", "Shift F3"},
372 {"\x1B[1;2S", "Shift F4"}, 399 {"\x1B[1;2S", "Shift F4"},
400
373 {"\x1B[15;2~", "Shift F5"}, 401 {"\x1B[15;2~", "Shift F5"},
374 {"\x1B[17;2~", "Shift F6"}, 402 {"\x1B[17;2~", "Shift F6"},
375 {"\x1B[18;2~", "Shift F7"}, 403 {"\x1B[18;2~", "Shift F7"},
@@ -379,39 +407,22 @@ struct key keys[] =
379 {"\x1B[23;2~", "Shift F11"}, 407 {"\x1B[23;2~", "Shift F11"},
380 {"\x1B[24;2~", "Shift F12"}, 408 {"\x1B[24;2~", "Shift F12"},
381 409
382// {"\x00", "^@"}, // NUL Commented out coz it's the C string terminator, and may confuse things. 410 // MC "Esc digit" specials.
383 {"\x01", "^A"}, // SOH 411 // NOTE - The MC Esc variations might not be such a good idea, other programs want the Esc key for other things.
384 {"\x02", "^B"}, // STX 412 // Notably seems that "Esc somekey" is used in place of "Alt somekey" AKA "Meta somekey" coz apparently some OSes swallow those.
385 {"\x03", "^C"}, // ETX SIGTERM 413 // Conversely, some terminals send "Esc somekey" when you do "Alt somekey".
386 {"\x04", "^D"}, // EOT 414 // MC Esc variants might be used on Macs for other things?
387 {"\x05", "^E"}, // ENQ 415 {"\x1B\x31", "F1"},
388 {"\x06", "^F"}, // ACK 416 {"\x1B\x32", "F2"},
389 {"\x07", "^G"}, // BEL 417 {"\x1B\x33", "F3"},
390 {"\x08", "Del"}, // BS Delete key, usually. 418 {"\x1B\x34", "F4"},
391 {"\x09", "Tab"}, // HT Tab key. 419 {"\x1B\x35", "F5"},
392 {"\x0A", "Return"}, // LF Return key. Roxterm at least is translating both Ctrl-J and Ctrl-M into this. 420 {"\x1B\x36", "F6"},
393 {"\x0B", "^K"}, // VT 421 {"\x1B\x37", "F7"},
394 {"\x0C", "^L"}, // FF 422 {"\x1B\x38", "F8"},
395 {"\x0D", "^M"}, // CR Other Return key, usually. 423 {"\x1B\x39", "F9"},
396 {"\x0E", "^N"}, // SO 424 {"\x1B\x30", "F10"},
397 {"\x0F", "^O"}, // SI 425
398 {"\x10", "^P"}, // DLE
399 {"\x11", "^Q"}, // DC1
400 {"\x12", "^R"}, // DC2
401 {"\x13", "^S"}, // DC3
402 {"\x14", "^T"}, // DC4
403 {"\x15", "^U"}, // NAK
404 {"\x16", "^V"}, // SYN
405 {"\x17", "^W"}, // ETB
406 {"\x18", "^X"}, // CAN
407 {"\x19", "^Y"}, // EM
408 {"\x1A", "^Z"}, // SUB
409// {"\x1B", "^["}, // ESC Esc key. Commented out coz it's the ANSI start byte in the above multibyte keys. Handled in the code with a timeout.
410 {"\x1C", "^\\"}, // FS
411 {"\x1D", "^]"}, // GS
412 {"\x1E", "^^"}, // RS
413 {"\x1F", "^_"}, // US
414 {"\x7f", "BS"}, // Backspace key, usually. Ctrl-? perhaps?
415 {NULL, NULL} 426 {NULL, NULL}
416}; 427};
417 428