]> git.lyx.org Git - features.git/commitdiff
fix bug when reading bind files
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 29 Jul 2003 09:43:15 +0000 (09:43 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 29 Jul 2003 09:43:15 +0000 (09:43 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7438 a592a061-630c-0410-9148-cb99ea01b6c8

po/POTFILES.in
src/ChangeLog
src/kbmap.C

index b03accf31800da5668b93156763525636410f1b5..87864eb78a9c19373b71ea7ee61e8fbd9678bc2c 100644 (file)
@@ -179,7 +179,6 @@ src/mathed/ref_inset.C
 src/paragraph.C
 src/paragraph_funcs.C
 src/rowpainter.C
-src/support/path_defines.C
 src/text.C
 src/text2.C
 src/text3.C
index 4a82b3151a34e2b972b0815ee6491dcd281441e5..a27cb2fd894dfb26405e6ade3a41e0c68db8bd4d 100644 (file)
@@ -1,3 +1,7 @@
+2003-07-29  Jean-Marc Lasgouttes  <lasgouttes@lyx.org>
+
+       * kbmap.C (read): fix error message when reading bind files
+
 2003-07-29  Angus Leeming  <leeming@lyx.org>
 
        * BufferView.[Ch] (ChangeCitationsIfUnique): This function most
index e1a0cce71e5f2a95e985c175d78d8fe4aad9e487..7f8fd03116cc0706cd6fd0759595f7026e1c4b7e 100644 (file)
@@ -93,15 +93,20 @@ bool kb_keymap::read(string const & bind_file)
 
        string const tmp = i18nLibFileSearch("bind", bind_file, "bind");
        lexrc.setFile(tmp);
-       if (!lexrc.isOK()) return false;
+       if (!lexrc.isOK()) {
+               lyxerr << "kb_keymap::read: cannot open bind file:" 
+                      << tmp << endl;
+               return false;
+       }
 
-       lyxerr[Debug::KBMAP] << "Reading bindfile:" << tmp << endl;
+       lyxerr[Debug::KBMAP] << "Reading bind file:" << tmp << endl;
 
        bool error = false;
-       while (lexrc.isOK()) {
+       while (!error && lexrc.isOK()) {
                switch (lexrc.lex()) {
                case LyXLex::LEX_UNDEF:
                        lexrc.printError("Unknown tag `$$Token'");
+                       error = true;
                        continue;
                case LyXLex::LEX_FEOF:
                        continue;
@@ -113,6 +118,7 @@ bool kb_keymap::read(string const & bind_file)
                                seq = lexrc.getString();
                        } else {
                                lexrc.printError("BN_BIND: Missing key sequence");
+                               error = true;
                                break;
                        }
                        
@@ -120,6 +126,7 @@ bool kb_keymap::read(string const & bind_file)
                                cmd = lexrc.getString();
                        } else {
                                lexrc.printError("BN_BIND: missing command");
+                               error = true;
                                break;
                        }
                        
@@ -127,16 +134,17 @@ bool kb_keymap::read(string const & bind_file)
                        if (!action == LFUN_UNKNOWN_ACTION) {
                                lexrc.printError("BN_BIND: Unknown LyX"
                                                 " function `$$Token'");
+                               error = true;
                                break;
                        }
                        
-                       error = (bind(seq, kb_action(action)) != string::npos);
+                       bind(seq, kb_action(action));
                        break;
                }
                case BN_BINDFILE:
                        if (lexrc.next()) {
                                string const tmp(lexrc.getString());
-                               error = read(tmp);
+                               error = !read(tmp);
                        } else {
                                lexrc.printError("BN_BINDFILE: Missing file name");
                                error = true;
@@ -147,11 +155,10 @@ bool kb_keymap::read(string const & bind_file)
                }
        }
 
-       if (error) {
-               lyxerr << "Error reading bind file: " << tmp << endl;
-       }
-
-       return error;
+       if (error)
+               lyxerr << "kb_keymap::read: error while reading bind file:" 
+                      << tmp << endl;
+       return !error;
 }