X-Git-Url: https://git.lyx.org/gitweb/?a=blobdiff_plain;f=src%2FCursor.cpp;h=997f5d5535217dba5dc9a03e273e5ed6e1b8dfe1;hb=908afb8e971d210202b883480968305e30ae0699;hp=0c8ee1d6c5abe5c1a59bccfe7ca784aabdcf9c80;hpb=e30f3d76d2bee0011ceaeb5f0cc221156458cbad;p=lyx.git diff --git a/src/Cursor.cpp b/src/Cursor.cpp index 0c8ee1d6c5..997f5d5535 100644 --- a/src/Cursor.cpp +++ b/src/Cursor.cpp @@ -1057,7 +1057,7 @@ void Cursor::updateTextTargetOffset() } -void Cursor::info(odocstream & os) const +void Cursor::info(odocstream & os, bool devel_mode) const { for (int i = 1, n = depth(); i < n; ++i) { operator[](i).inset().infoize(os); @@ -1069,6 +1069,14 @@ void Cursor::info(odocstream & os) const if (inset) prevInset()->infoize2(os); } + if (devel_mode) { + InsetMath * math = inset().asInsetMath(); + if (math) + os << _(", Inset: ") << math->id(); + os << _(", Cell: ") << idx(); + os << _(", Position: ") << pos(); + } + } @@ -1456,9 +1464,10 @@ bool Cursor::macroModeClose() MathWordList const & words = mathedWordList(); MathWordList::const_iterator it = words.find(name); - bool keep_mathmode = it != words.end() && (it->second.inset == "font" - || it->second.inset == "oldfont" - || it->second.inset == "mbox"); + bool keep_mathmode = user_macro + || (it != words.end() && (it->second.inset == "font" + || it->second.inset == "oldfont" + || it->second.inset == "mbox")); bool ert_macro = !user_macro && it == words.end() && atomAsMacro; if (in && in->currentMode() == Inset::TEXT_MODE @@ -1979,6 +1988,8 @@ bool Cursor::upDownInText(bool up, bool & updateNeeded) bool bound = false; top().pos() = tm.getPosNearX(real_next_row, xo, bound); boundary(bound); + // When selection==false, this is done by TextMetrics::editXY + setCurrentFont(); updateNeeded |= bv().checkDepm(*this, old); } @@ -2106,23 +2117,16 @@ docstring Cursor::selectionAsString(bool with_label) const } -docstring Cursor::currentState() const +docstring Cursor::currentState(bool devel_mode) const { if (inMathed()) { odocstringstream os; - info(os); -#ifdef DEVEL_VERSION - InsetMath * math = inset().asInsetMath(); - if (math) - os << _(", Inset: ") << math->id(); - os << _(", Cell: ") << idx(); - os << _(", Position: ") << pos(); -#endif + info(os, devel_mode); return os.str(); } if (inTexted()) - return text()->currentState(*this); + return text()->currentState(*this, devel_mode); return docstring(); }