]> git.lyx.org Git - lyx.git/commitdiff
fix ugly kbsequence parsing ; support cursor keys in numpad
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 29 May 2001 14:16:39 +0000 (14:16 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 29 May 2001 14:16:39 +0000 (14:16 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2056 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/kbsequence.C
src/lyx_main.C

index 1a2645d0855ed3d31aedd60e8bd79b8fec9d1543..52075200b9f4d8c047c8bbba87661e21a8fb09b2 100644 (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
index 29b7d453b0ffdb1d62206291f25ea0a94fe91b08..ce5b2127feb2c7f3deb95ae44bac126e413c4524 100644 (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;
index 7c1ef189a80a9ee889e81312ef028535c7d7b2fa..d3b9e8b3e7935bef25ba9d9f910f7202e1c76be2 100644 (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