Better support of general arrow keys

This commit is contained in:
Markus Gans 2020-04-15 10:55:23 +02:00
parent 7a520dc944
commit 1ff34f64e1
3 changed files with 27 additions and 8 deletions

View File

@ -1,3 +1,6 @@
2020-04-15 Markus Gans <guru.mail@muenster.de>
* Better support of general arrow keys
2020-04-13 Markus Gans <guru.mail@muenster.de>
* Several small code improvements

View File

@ -41,6 +41,7 @@ FKeyMap fkey[] =
{ fc::Fkey_dl , nullptr, "kL" }, // delete-line key
{ fc::Fkey_down , nullptr, "kd" }, // down-arrow key
{ fc::Fkey_down , nullptr, "kdx"}, // down-arrow key
{ fc::Fkey_down , nullptr, "kdX"}, // down-arrow key
{ fc::Fkey_eic , nullptr, "kM" }, // sent by rmir or smir in insert mode
{ fc::Fkey_eol , nullptr, "kE" }, // clear-to-end-of-line key
{ fc::Fkey_eos , nullptr, "kS" }, // clear-to-end-of-screen key
@ -69,16 +70,19 @@ FKeyMap fkey[] =
{ fc::Fkey_il , nullptr, "kA" }, // insert-line key
{ fc::Fkey_left , nullptr, "kl" }, // left-arrow key
{ fc::Fkey_left , nullptr, "klx"}, // left-arrow key
{ fc::Fkey_left , nullptr, "klX"}, // left-arrow key
{ fc::Fkey_ll , nullptr, "kH" }, // last-line key
{ fc::Fkey_npage , nullptr, "kN" }, // next-page key
{ fc::Fkey_ppage , nullptr, "kP" }, // prev-page key
{ fc::Fkey_right , nullptr, "kr" }, // right-arrow key
{ fc::Fkey_right , nullptr, "krx"}, // right-arrow key
{ fc::Fkey_right , nullptr, "krX"}, // right-arrow key
{ fc::Fkey_sf , nullptr, "kF" }, // scroll-forward key (shift-up)
{ fc::Fkey_sr , nullptr, "kR" }, // scroll-backward key (shift-down)
{ fc::Fkey_stab , nullptr, "kT" }, // set-tab key
{ fc::Fkey_up , nullptr, "ku" }, // up-arrow key
{ fc::Fkey_up , nullptr, "kux"}, // up-arrow key
{ fc::Fkey_up , nullptr, "kuX"}, // up-arrow key
{ fc::Fkey_a1 , nullptr, "K1" }, // upper left of keypad
{ fc::Fkey_a3 , nullptr, "K3" }, // upper right of keypad
{ fc::Fkey_b2 , nullptr, "K2" }, // center of keypad

View File

@ -287,28 +287,40 @@ void FTermcap::termcapKeysVt100()
for (std::size_t i{0}; fc::fkey[i].tname[0] != 0; i++)
{
if ( std::strncmp(fc::fkey[i].tname, "kux", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "A"); // Key up
fc::fkey[i].string = C_STR(CSI "A"); // Key up (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "kuX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OA"); // Key up (application mode)
if ( std::strncmp(fc::fkey[i].tname, "kdx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "B"); // Key down
fc::fkey[i].string = C_STR(CSI "B"); // Key down (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "kdX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OB"); // Key down (application mode)
if ( std::strncmp(fc::fkey[i].tname, "krx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "C"); // Key right
fc::fkey[i].string = C_STR(CSI "C"); // Key right (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "krX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OC"); // Key right (application mode)
if ( std::strncmp(fc::fkey[i].tname, "klx", 3) == 0 )
fc::fkey[i].string = C_STR(CSI "D"); // Key left
fc::fkey[i].string = C_STR(CSI "D"); // Key left (standard mode)
if ( std::strncmp(fc::fkey[i].tname, "klX", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OD"); // Key left (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k1X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OP"); // PF1
fc::fkey[i].string = C_STR(ESC "OP"); // PF1 (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k2X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OQ"); // PF2
fc::fkey[i].string = C_STR(ESC "OQ"); // PF2 (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k3X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OR"); // PF3
fc::fkey[i].string = C_STR(ESC "OR"); // PF3 (application mode)
if ( std::strncmp(fc::fkey[i].tname, "k4X", 3) == 0 )
fc::fkey[i].string = C_STR(ESC "OS"); // PF4
fc::fkey[i].string = C_STR(ESC "OS"); // PF4 (application mode)
}
}