mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 19:25:39 +00:00
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
This commit is contained in:
parent
528a1a42d4
commit
4df4a61701
@ -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;
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user