Added Keypad [/], [*], [-], [+] support

This commit is contained in:
Markus Gans 2018-07-29 13:25:16 +02:00
parent 0e86de5c81
commit d4a163065d
5 changed files with 1145 additions and 410 deletions

View File

@ -1,3 +1,7 @@
2017-07-29 Markus Gans <guru.mail@muenster.de>
* Added numeric Keypad [/], [*], [-], [+] support
* More tests in FKeyboard unit test
2017-07-27 Markus Gans <guru.mail@muenster.de>
* The array for keyboard input of UTF-8 characters was
not long enough for 4 bytes of UTF-8 codes.

View File

@ -284,7 +284,22 @@ enum keys
Fckey_right_square_bracket = 0x000001d, // control-]
Fckey_caret = 0x000001e, // control-^
Fckey_underscore = 0x000001f, // control-_
Fkey_space = 0x0000020,
Fkey_space = 0x0000020, // space
Fkey_exclamation_mark = 0x0000021, // !
Fkey_quotation_mark = 0x0000022, // "
Fkey_number_sign = 0x0000023, // #
Fkey_dollar_sign = 0x0000024, // $
Fkey_percent_sign = 0x0000025, // %
Fkey_ampersand = 0x0000026, // &
Fkey_apostrophe = 0x0000027, // '
Fkey_left_parentheses = 0x0000028, // (
Fkey_right_parentheses = 0x0000029, // )
Fkey_asterisk = 0x000002a, // *
Fkey_plus_sign = 0x000002b, // +
Fkey_comma = 0x000002c, // ,
Fkey_minus_sign = 0x000002d, // -
Fkey_full_stop = 0x000002e, // .
Fkey_slash = 0x000002f, // /
Fckey_space = 0x1000020, // control-space
Fkey_backspace = 0x1000100,
Fkey_catab = 0x1000101,

View File

@ -69,8 +69,8 @@ fkeymap Fkey[] =
{ fc::Fkey_ppage , 0, "kP" }, // prev-page key
{ fc::Fkey_right , 0, "kr" }, // right-arrow key
{ fc::Fkey_right , 0, "krx"}, // right-arrow key
{ fc::Fkey_sf , 0, "kF" }, // scroll-forward key
{ fc::Fkey_sr , 0, "kR" }, // scroll-backward key
{ fc::Fkey_sf , 0, "kF" }, // scroll-forward key (shift-up)
{ fc::Fkey_sr , 0, "kR" }, // scroll-backward key (shift-down)
{ fc::Fkey_stab , 0, "kT" }, // set-tab key
{ fc::Fkey_up , 0, "ku" }, // up-arrow key
{ fc::Fkey_up , 0, "kux"}, // up-arrow key
@ -90,8 +90,13 @@ fkeymap Fkey[] =
{ fc::Fkey_end , 0, "@7x"}, // end key
{ fc::Fkey_end , 0, "@7X"}, // end key
{ fc::Fkey_enter , 0, "@8" }, // enter/send key
{ fc::Fkey_enter , 0, "@8x"}, // enter/send key
{ fc::Fkey_exit , 0, "@9" }, // exit key
{ fc::Fkey_find , 0, "@0" }, // find key
{ fc::Fkey_slash , 0, "KP1"}, // keypad slash
{ fc::Fkey_asterisk , 0, "KP2"}, // keypad asterisk
{ fc::Fkey_minus_sign, 0, "KP3"}, // keypad minus sign
{ fc::Fkey_plus_sign , 0, "KP4"}, // keypad plus sign
{ fc::Fkey_help , 0, "%1" }, // help key
{ fc::Fkey_mark , 0, "%2" }, // mark key
{ fc::Fkey_message , 0, "%3" }, // message key
@ -110,35 +115,35 @@ fkeymap Fkey[] =
{ fc::Fkey_save , 0, "&6" }, // save key
{ fc::Fkey_suspend , 0, "&7" }, // suspend key
{ fc::Fkey_undo , 0, "&8" }, // undo key
{ fc::Fkey_sbeg , 0, "&9" }, // shifted key
{ fc::Fkey_scancel , 0, "&0" }, // shifted key
{ fc::Fkey_scommand , 0, "*1" }, // shifted key
{ fc::Fkey_scopy , 0, "*2" }, // shifted key
{ fc::Fkey_screate , 0, "*3" }, // shifted key
{ fc::Fkey_sdc , 0, "*4" }, // shifted key
{ fc::Fkey_sdl , 0, "*5" }, // shifted key
{ fc::Fkey_sbeg , 0, "&9" }, // shifted begin key
{ fc::Fkey_scancel , 0, "&0" }, // shifted cancel key
{ fc::Fkey_scommand , 0, "*1" }, // shifted command key
{ fc::Fkey_scopy , 0, "*2" }, // shifted copy key
{ fc::Fkey_screate , 0, "*3" }, // shifted create key
{ fc::Fkey_sdc , 0, "*4" }, // shifted delete-character key
{ fc::Fkey_sdl , 0, "*5" }, // shifted delete-line key
{ fc::Fkey_select , 0, "*6" }, // select key
{ fc::Fkey_send , 0, "*7" }, // shifted key
{ fc::Fkey_seol , 0, "*8" }, // shifted key
{ fc::Fkey_sexit , 0, "*9" }, // shifted key
{ fc::Fkey_sfind , 0, "*0" }, // shifted key
{ fc::Fkey_shelp , 0, "#1" }, // shifted key
{ fc::Fkey_shome , 0, "#2" }, // shifted key
{ fc::Fkey_sic , 0, "#3" }, // shifted key
{ fc::Fkey_sleft , 0, "#4" }, // shifted key
{ fc::Fkey_smessage , 0, "%a" }, // shifted key
{ fc::Fkey_smove , 0, "%b" }, // shifted key
{ fc::Fkey_snext , 0, "%c" }, // shifted key
{ fc::Fkey_soptions , 0, "%d" }, // shifted key
{ fc::Fkey_sprevious, 0, "%e" }, // shifted key
{ fc::Fkey_sprint , 0, "%f" }, // shifted key
{ fc::Fkey_sredo , 0, "%g" }, // shifted key
{ fc::Fkey_sreplace , 0, "%h" }, // shifted key
{ fc::Fkey_sright , 0, "%i" }, // shifted key
{ fc::Fkey_srsume , 0, "%j" }, // shifted key
{ fc::Fkey_ssave , 0, "!1" }, // shifted key
{ fc::Fkey_ssuspend , 0, "!2" }, // shifted key
{ fc::Fkey_sundo , 0, "!3" }, // shifted key
{ fc::Fkey_send , 0, "*7" }, // shifted end key
{ fc::Fkey_seol , 0, "*8" }, // shifted clear-to-end-of-line key
{ fc::Fkey_sexit , 0, "*9" }, // shifted exit key
{ fc::Fkey_sfind , 0, "*0" }, // shifted find key
{ fc::Fkey_shelp , 0, "#1" }, // shifted help key
{ fc::Fkey_shome , 0, "#2" }, // shifted home key
{ fc::Fkey_sic , 0, "#3" }, // shifted insert-character key
{ fc::Fkey_sleft , 0, "#4" }, // shifted left-arrow key
{ fc::Fkey_smessage , 0, "%a" }, // shifted message key
{ fc::Fkey_smove , 0, "%b" }, // shifted move key
{ fc::Fkey_snext , 0, "%c" }, // shifted next key
{ fc::Fkey_soptions , 0, "%d" }, // shifted options key
{ fc::Fkey_sprevious , 0, "%e" }, // shifted previous key
{ fc::Fkey_sprint , 0, "%f" }, // shifted print key
{ fc::Fkey_sredo , 0, "%g" }, // shifted redo key
{ fc::Fkey_sreplace , 0, "%h" }, // shifted replace key
{ fc::Fkey_sright , 0, "%i" }, // shifted right-arrow key
{ fc::Fkey_srsume , 0, "%j" }, // shifted resume key
{ fc::Fkey_ssave , 0, "!1" }, // shifted save key
{ fc::Fkey_ssuspend , 0, "!2" }, // shifted suspend key
{ fc::Fkey_sundo , 0, "!3" }, // shifted undo key
{ fc::Fkey_f11 , 0, "F1" }, // F11 function key
{ fc::Fkey_f12 , 0, "F2" }, // F12 function key
{ fc::Fkey_f13 , 0, "F3" }, // F13 function key

View File

@ -1327,6 +1327,22 @@ void FTerm::init_termcap_keys (char*& buffer)
// Fallback for TERM=ansi
if ( std::strncmp(fc::Fkey[i].tname, "@7X", 3) == 0 )
fc::Fkey[i].string = C_STR(CSI "K"); // End key
// Keypad keys
if ( std::strncmp(fc::Fkey[i].tname, "@8x", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "OM"); // Enter key
if ( std::strncmp(fc::Fkey[i].tname, "KP1", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oo"); // Keypad slash
if ( std::strncmp(fc::Fkey[i].tname, "KP2", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Oj"); // Keypad asterisk
if ( std::strncmp(fc::Fkey[i].tname, "KP3", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Om"); // Keypad minus sign
if ( std::strncmp(fc::Fkey[i].tname, "KP4", 3) == 0 )
fc::Fkey[i].string = C_STR(ESC "Ok"); // Keypad plus sign
}
// Some terminals (e.g. PuTTY) send the wrong code for the arrow keys

File diff suppressed because it is too large Load Diff