From 97a158fd8e91c37bfe015f4bf1c63a952a8ac861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20P=C3=B6nitz?= Date: Fri, 15 Jul 2005 08:51:34 +0000 Subject: [PATCH] small cosmetic fix and removing some debug output git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@10198 a592a061-630c-0410-9148-cb99ea01b6c8 --- src/mathed/ChangeLog | 4 ++++ src/mathed/math_charinset.C | 2 +- src/mathed/math_factory.C | 5 ++--- src/mathed/math_hullinset.C | 2 +- src/mathed/math_inset.C | 12 +++++++++--- src/mathed/math_nestinset.C | 18 +++++++++--------- src/mathed/math_scriptinset.C | 4 ++-- src/text2.C | 2 +- src/text3.C | 2 +- 9 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/mathed/ChangeLog b/src/mathed/ChangeLog index e10d7fa3d6..1b35d80574 100644 --- a/src/mathed/ChangeLog +++ b/src/mathed/ChangeLog @@ -1,4 +1,8 @@ +2005-07-15 André Pönitz + + * math_inset.C (write): don't output too many spaces + 2005-07-15 Andreas Vox * math_hullinset.C (editXY): partial fix for #622 diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index 90ede4b84c..290815d88b 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -133,7 +133,7 @@ void MathCharInset::write(WriteStream & os) const void MathCharInset::normalize(NormalStream & os) const { - os << "[char " << char_ << ' ' << "mathalpha]"; + os << "[char " << char_ << " mathalpha]"; } diff --git a/src/mathed/math_factory.C b/src/mathed/math_factory.C index 98d4e110e8..c865d52e0a 100644 --- a/src/mathed/math_factory.C +++ b/src/mathed/math_factory.C @@ -234,9 +234,7 @@ void initMath() latexkeys const * in_word_set(string const & str) { WordList::iterator it = theWordList.find(str); - //lyxerr << "looking up '" << str << "' found: " - // << (it != theWordList.end()) << endl; - return (it != theWordList.end()) ? &(it->second) : 0; + return it != theWordList.end() ? &(it->second) : 0; } @@ -366,3 +364,4 @@ bool createMathInset_fromDialogStr(string const & str, MathArray & ar) return ar[0].nucleus(); } + diff --git a/src/mathed/math_hullinset.C b/src/mathed/math_hullinset.C index b920084405..ae423b5b78 100644 --- a/src/mathed/math_hullinset.C +++ b/src/mathed/math_hullinset.C @@ -712,7 +712,7 @@ void MathHullInset::setType(string const & type) void MathHullInset::mutate(string const & newtype) { - lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl; + //lyxerr << "mutating from '" << type_ << "' to '" << newtype << "'" << endl; // we try to move along the chain // none <-> simple <-> equation <-> eqnarray -> *align* -> multline, gather -+ diff --git a/src/mathed/math_inset.C b/src/mathed/math_inset.C index d7fc527af1..2f1cbe3d6b 100644 --- a/src/mathed/math_inset.C +++ b/src/mathed/math_inset.C @@ -16,6 +16,8 @@ #include "math_mathmlstream.h" #include "debug.h" +#include "support/lstrings.h" + using std::string; using std::ostream; using std::endl; @@ -65,8 +67,12 @@ void MathInset::drawT(TextPainter &, int, int) const void MathInset::write(WriteStream & os) const { - os << '\\' << name().c_str(); - os.pendingSpace(true); + string const s = name(); + os << '\\' << s.c_str();S + // We need an extra ' ' unless this is a single-char-non-ASCII name + // or anything non-ASCII follows + if (s.size() != 1 || isalpha(s[0])) + os.pendingSpace(true); } @@ -113,7 +119,7 @@ void MathInset::mathmlize(MathMLStream & os) const string const & MathInset::getType() const { - static string const t("none"); + static string const t = "none"; return t; } diff --git a/src/mathed/math_nestinset.C b/src/mathed/math_nestinset.C index 90addf0155..5f83787f05 100644 --- a/src/mathed/math_nestinset.C +++ b/src/mathed/math_nestinset.C @@ -983,7 +983,7 @@ void MathNestInset::edit(LCursor & cur, bool left) cur.idx() = left ? 0 : cur.lastidx(); cur.pos() = left ? 0 : cur.lastpos(); cur.resetAnchor(); - lyxerr << "MathNestInset::edit, cur:\n" << cur << endl; + //lyxerr << "MathNestInset::edit, cur:\n" << cur << endl; } @@ -1002,7 +1002,7 @@ InsetBase * MathNestInset::editXY(LCursor & cur, int x, int y) cur.push(*this); cur.idx() = idx_min; cur.pos() = ar.x2pos(x - ar.xo()); - lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl; + //lyxerr << "found cell : " << idx_min << " pos: " << cur.pos() << endl; if (dist_min == 0) { // hit inside cell for (pos_type i = 0, n = ar.size(); i < n; ++i) @@ -1077,7 +1077,7 @@ void MathNestInset::lfunMouseRelease(LCursor & cur, FuncRequest & cmd) bool MathNestInset::interpret(LCursor & cur, char c) { - lyxerr << "interpret 2: '" << c << "'" << endl; + //lyxerr << "interpret 2: '" << c << "'" << endl; cur.clearTargetX(); // handle macroMode @@ -1189,7 +1189,6 @@ bool MathNestInset::interpret(LCursor & cur, char c) script(cur, false); return true; } - if (c == '^') { script(cur, true); return true; @@ -1200,7 +1199,8 @@ bool MathNestInset::interpret(LCursor & cur, char c) } } - if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%') { + if (c == '{' || c == '}' || c == '&' || c == '$' || c == '#' || c == '%' + || c == '_' || c == '^') { cur.niceInsert(createMathInset(string(1, c))); return true; } @@ -1248,10 +1248,10 @@ bool MathNestInset::script(LCursor & cur, bool up) // convert the thing to our left to a scriptinset or create a new // one if in the very first position of the array if (cur.pos() == 0) { - lyxerr << "new scriptinset" << endl; + //lyxerr << "new scriptinset" << endl; cur.insert(new MathScriptInset(up)); } else { - lyxerr << "converting prev atom " << endl; + //lyxerr << "converting prev atom " << endl; cur.prevAtom() = MathAtom(new MathScriptInset(cur.prevAtom(), up)); } --cur.pos(); @@ -1260,9 +1260,9 @@ bool MathNestInset::script(LCursor & cur, bool up) cur.idx() = 1; cur.pos() = 0; } - lyxerr << "pasting 1: safe:\n" << safe << endl; + //lyxerr << "pasting 1: safe:\n" << safe << endl; cur.paste(safe); cur.resetAnchor(); - lyxerr << "pasting 2: safe:\n" << safe << endl; + //lyxerr << "pasting 2: safe:\n" << safe << endl; return true; } diff --git a/src/mathed/math_scriptinset.C b/src/mathed/math_scriptinset.C index cf23765572..8ef1c8be59 100644 --- a/src/mathed/math_scriptinset.C +++ b/src/mathed/math_scriptinset.C @@ -556,7 +556,7 @@ void MathScriptInset::notifyCursorLeaves(LCursor & cur) { MathNestInset::notifyCursorLeaves(cur); - lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl; + //lyxerr << "MathScriptInset::notifyCursorLeaves: 1 " << cur << endl; // remove empty scripts if possible if (1) { @@ -569,7 +569,7 @@ if (1) { } } - lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl; + //lyxerr << "MathScriptInset::notifyCursorLeaves: 2 " << cur << endl; } diff --git a/src/text2.C b/src/text2.C index 8b0460572d..b993d6e6a9 100644 --- a/src/text2.C +++ b/src/text2.C @@ -928,7 +928,7 @@ InsetBase * LyXText::editXY(LCursor & cur, int x, int y) // try to descend into nested insets InsetBase * inset = checkInsetHit(x, y); - lyxerr << "inset " << inset << " hit at x: " << x << " y: " << y << endl; + //lyxerr << "inset " << inset << " hit at x: " << x << " y: " << y << endl; if (!inset) { // Either we deconst editXY or better we move current_font // and real_current_font to LCursor diff --git a/src/text3.C b/src/text3.C index 16a2fe645f..35fc074caf 100644 --- a/src/text3.C +++ b/src/text3.C @@ -132,7 +132,7 @@ namespace { { recordUndo(cur); string sel = cur.selectionAsString(false); - lyxerr << "selection is: '" << sel << "'" << endl; + //lyxerr << "selection is: '" << sel << "'" << endl; if (sel.empty()) { const int old_pos = cur.pos();