The bug was due to a bug in lyxstring (operator <<)
The problem was that the code did not skip the whitespace before the first
non whitespace char.
Attached are two possible fixes:
The first one was copied from g++-2/std/bastring.cc
(I don't know what side-effects is.ipfx0 has).
The second one does the whitespace skipping manually.
Index: lyxstring.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lyxstring.C,v
retrieving revision 1.53
diff -u -p -r1.53 lyxstring.C
--- lyxstring.C 6 Apr 2002 12:42:42 -0000       1.53
+++ lyxstring.C 1 May 2002 15:32:19 -0000
@@ -1745,12 +1745,15 @@ istream & operator>>(istream & is, lyxst
        // better solution
        int w = is.width(0);
        s.clear();
-       char c = 0;
-       while (is.get(c)) {
-               if (isspace(c)) { is.putback(c); break; }
-               s += c;
-               if (--w == 1) break;
+        if (is.ipfx0()) {
+               char c = 0;
+               while (is.get(c)) {
+                       if (isspace(c)) { is.putback(c); break; }
+                       s += c;
+                       if (--w == 1) break;
+               }
        }
+       is.isfx();
        if (s.empty()) is.setstate(std::ios::failbit);
 #endif
        return is;
Index: lyxstring.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/support/lyxstring.C,v
retrieving revision 1.53
diff -u -p -r1.53 lyxstring.C
--- lyxstring.C 6 Apr 2002 12:42:42 -0000       1.53
+++ lyxstring.C 1 May 2002 15:40:42 -0000
@@ -1746,9 +1746,17 @@ istream & operator>>(istream & is, lyxst
        int w = is.width(0);
        s.clear();
        char c = 0;
+       bool skipspace = true;
        while (is.get(c)) {
-               if (isspace(c)) { is.putback(c); break; }
-               s += c;
+               if (isspace(c)) {
+                       if (!skipspace) {
+                               is.putback(c);
+                               break; 
+                       }
+               } else {
+                       s += c;
+                       skipspace = false;
+               }
                if (--w == 1) break;
        }
        if (s.empty()) is.setstate(std::ios::failbit);


Reply via email to