fix ugly kbsequence parsing ; support cursor keys in numpad

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2056 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2001-05-29 14:16:39 +00:00
parent 4f594edad6
commit 923c27cc11
3 changed files with 20 additions and 2 deletions

View File

@ -1,3 +1,12 @@
2001-05-29 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* 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 <larsbj@birdstep.com>
* lyx_main.C (defaultKeyBindings): move self-insert KP_ bindings

View File

@ -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;

View File

@ -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