]> git.lyx.org Git - lyx.git/commitdiff
temporary reversal of the 'don't write spaces' stuff as this was buggy...
authorAndré Pönitz <poenitz@gmx.net>
Thu, 22 Aug 2002 11:57:58 +0000 (11:57 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Thu, 22 Aug 2002 11:57:58 +0000 (11:57 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5070 a592a061-630c-0410-9148-cb99ea01b6c8

src/mathed/math_mathmlstream.C
src/mathed/math_mathmlstream.h

index 5a1f6017d8d06e7e048a52de4b5dfc71c260e317..a1f73f0e3f15e37480b45b9bf5e5192b799a128b 100644 (file)
@@ -3,6 +3,7 @@
 #include "math_mathmlstream.h"
 #include "math_inset.h"
 #include "math_extern.h"
+#include "debug.h"
 #include "support/lyxalgo.h"
 #include "support/LOstream.h"
 
@@ -23,12 +24,27 @@ WriteStream::WriteStream(ostream & os)
 {}
 
 
+WriteStream::~WriteStream()
+{
+       if (pendingspace_)
+               os_ << ' ';
+}
+
+
 void WriteStream::addlines(unsigned int n)
 {
        line_ += n;
 }
 
 
+void WriteStream::pendingSpace(bool how)
+{
+       if (how)
+               os_ << ' ';
+       pendingspace_ = how;
+}
+
+
 WriteStream & operator<<(WriteStream & ws, MathAtom const & at)
 {
        at->write(ws);
@@ -45,6 +61,11 @@ WriteStream & operator<<(WriteStream & ws, MathArray const & ar)
 
 WriteStream & operator<<(WriteStream & ws, char const * s)
 {
+       if (ws.pendingSpace()) {
+               lyxerr << "writing a space in a string\n";
+               ws.os() << ' ';
+               ws.pendingSpace(false);
+       }
        ws.os() << s;
        ws.addlines(int(lyx::count(s, s + strlen(s), '\n')));
        return ws;
@@ -54,8 +75,12 @@ WriteStream & operator<<(WriteStream & ws, char const * s)
 WriteStream & operator<<(WriteStream & ws, char c)
 {
        if (ws.pendingSpace()) {
-               if (isalpha(c))
-                       ws.os() << ' ';
+               //if (isalpha(c))
+               //      ws.os() << ' ';
+               if (!isalpha(c)) {
+                       lyxerr << "I'd like to suppress writing a space\n";
+               }
+               ws.os() << ' ';
                ws.pendingSpace(false);
        }
        ws.os() << c;
index 9f1ac9fed24646523888050a6b6349a8d51cedaa..ebd7c652420dde39b2ab9c2bd96aa46564e4b1b9 100644 (file)
@@ -25,6 +25,8 @@ public:
        ///
        explicit WriteStream(std::ostream & os_);
        ///
+       ~WriteStream();
+       ///
        int line() const { return line_; }
        ///
        bool fragile() const { return fragile_; }
@@ -37,7 +39,7 @@ public:
        ///
        void addlines(unsigned int);
        /// writes space if next thing is isalpha()
-       void pendingSpace(bool how) { pendingspace_ = how; }
+       void pendingSpace(bool how);
        /// writes space if next thing is isalpha()
        bool pendingSpace() const { return pendingspace_; }
 private: