diff --git a/src/ChangeLog b/src/ChangeLog index 1a2645d085..52075200b9 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2001-05-29 Jean-Marc Lasgouttes + + * kbsequence.C (parse): de-uglify a bit the parsing code, which + relied on 0 terminated strings and other horrors. Bug found due to + the new assert in lyxstring! + + * lyx_main.C (defaultKeyBindings): add bindings the cursor-related + KP_ keys. + 2001-05-29 Lars Gullik Bjønnes * lyx_main.C (defaultKeyBindings): move self-insert KP_ bindings diff --git a/src/kbsequence.C b/src/kbsequence.C index 29b7d453b0..ce5b2127fe 100644 --- a/src/kbsequence.C +++ b/src/kbsequence.C @@ -103,7 +103,7 @@ int kb_sequence::parse(string const & s) if (s[i] && (s[i]) <= ' ') ++i; if (i >= s.length()) break; - if (s[i + 1] == '-') { // is implicit that s[i] == true + if (i + 1 < s.length() && s[i + 1] == '-') { switch (s[i]) { case 's': case 'S': mod |= ShiftMask; @@ -120,7 +120,8 @@ int kb_sequence::parse(string const & s) default: return i + 1; } - } else if (s[i] == '~' && s[i + 1] && s[i + 2] == '-') { + } else if (i + 2 < s.length() && s[i] == '~' + && s[i + 2] == '-') { switch (s[i + 1]) { case 's': case 'S': nmod |= ShiftMask; diff --git a/src/lyx_main.C b/src/lyx_main.C index 7c1ef189a8..d3b9e8b3e7 100644 --- a/src/lyx_main.C +++ b/src/lyx_main.C @@ -487,6 +487,14 @@ void LyX::defaultKeyBindings(kb_keymap * kbmap) //kbmap->bind("KP_Divide", LFUN_SELFINSERT); //kbmap->bind("KP_Multiply", LFUN_SELFINSERT); //kbmap->bind("KP_Subtract", LFUN_SELFINSERT); + kbmap->bind("KP_Right", LFUN_RIGHT); + kbmap->bind("KP_Left", LFUN_LEFT); + kbmap->bind("KP_Up", LFUN_UP); + kbmap->bind("KP_Down", LFUN_DOWN); + kbmap->bind("KP_Home", LFUN_HOME); + kbmap->bind("KP_End", LFUN_END); + kbmap->bind("KP_Prior", LFUN_PRIOR); + kbmap->bind("KP_Next", LFUN_NEXT); kbmap->bind("C-Tab", LFUN_TABINSERT); // ale970515 kbmap->bind("S-Tab", LFUN_SHIFT_TAB); // jug20000522