]> git.lyx.org Git - features.git/commitdiff
Revert John's change as it breaks reading of the user preamble.
authorAngus Leeming <leeming@lyx.org>
Fri, 2 Aug 2002 16:18:15 +0000 (16:18 +0000)
committerAngus Leeming <leeming@lyx.org>
Fri, 2 Aug 2002 16:18:15 +0000 (16:18 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@4845 a592a061-630c-0410-9148-cb99ea01b6c8

src/ChangeLog
src/lyxlex.C

index f9375e9de7511979f53e6992f10f9bf6b5a326f3..acbbb1faf2c6223be5b10c3662c98f8b510138ac 100644 (file)
@@ -1,3 +1,8 @@
+2002-08-02  Angus Leeming  <leeming@lyx.org>
+
+       * lyxlex.C: revert John's change as it breaks reading of the user
+       preamble.
 2002-08-02  Angus Leeming  <leeming@lyx.org>
 
        * importer.C (Import):
index a6aca998a6197f0ca56dc60d9f298b2837e155c9..e9c8beb0c44c5cb12cfa510048e9025fd0d8afe9 100644 (file)
@@ -168,28 +168,29 @@ string const LyXLex::getLongString(string const & endtoken)
 
                // We do a case independent comparison, like search_kw
                // does.
-               if (compare_ascii_no_case(token, endtoken) == 0)        
-                       break;
-
-               string tmpstr = getString();
-               if (firstline) {
-                       string::size_type i(tmpstr.find_first_not_of(' '));
-                       if (i != string::npos)
-                               prefix = tmpstr.substr(0, i);
-                       firstline = false;
-                       lyxerr[Debug::PARSER]
-                               << "Prefix = `" << prefix << "\'" << endl;
+               if (compare_ascii_no_case(token, endtoken) != 0) {
+                       string tmpstr = getString();
+                       if (firstline) {
+                               unsigned int i = 0;
+                               while (i < tmpstr.length()
+                                     && tmpstr[i] == ' ') {
+                                       ++i;
+                                       prefix += ' ';
+                               }
+                               firstline = false;
+                               lyxerr[Debug::PARSER] << "Prefix = `" << prefix
+                                                     << '\'' << endl;
+                       }
+
+                       if (!prefix.empty()
+                           && prefixIs(tmpstr, prefix)) {
+                               tmpstr.erase(0, prefix.length() - 1);
+                       }
+                       str += ltrim(tmpstr, "\t") + '\n';
                }
-
-               // further lines in long strings may have the same
-               // whitespace prefix as the first line. Remove it.
-               if (prefixIs(tmpstr, prefix)) {
-                       tmpstr.erase(0, prefix.length() - 1);
-               }
-               str += ltrim(tmpstr, "\t") + '\n';
+               else // token == endtoken
+                       break;
        }
        if (!isOK()) {
                printError("Long string not ended by `" + endtoken + '\'');
        }