From: André Pönitz Date: Thu, 22 Aug 2002 11:57:58 +0000 (+0000) Subject: temporary reversal of the 'don't write spaces' stuff as this was buggy... X-Git-Tag: 1.6.10~18496 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=4df4a6170192578ac2010b82966d87ca92e6d211;p=lyx.git temporary reversal of the 'don't write spaces' stuff as this was buggy... git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5070 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_mathmlstream.C b/src/mathed/math_mathmlstream.C index 5a1f6017d8..a1f73f0e3f 100644 --- a/src/mathed/math_mathmlstream.C +++ b/src/mathed/math_mathmlstream.C @@ -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; diff --git a/src/mathed/math_mathmlstream.h b/src/mathed/math_mathmlstream.h index 9f1ac9fed2..ebd7c65242 100644 --- a/src/mathed/math_mathmlstream.h +++ b/src/mathed/math_mathmlstream.h @@ -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: