mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Fix insertion of text characters in math
Characters that needed to be inserted in text mode in mathed were not correctly inserted. Here we do two fixes: 1/ in niceInsert(), do not replace the contents of the active insets first cell with selection, insert selection instead. This wa sthe cause of the bug: an empty selection replaced the contents that was already in the cell. 2/ do not use niceInsert() anyway, insert() is perfect for what we want to do. Fixes bug #11527.
This commit is contained in:
parent
48084a3d9c
commit
dfba0d8667
@ -1547,7 +1547,9 @@ void Cursor::niceInsert(MathAtom const & t)
|
|||||||
// If possible, enter the new inset and move the contents of the selection
|
// If possible, enter the new inset and move the contents of the selection
|
||||||
if (t->isActive()) {
|
if (t->isActive()) {
|
||||||
idx_type const idx = prevMath().asNestInset()->firstIdx();
|
idx_type const idx = prevMath().asNestInset()->firstIdx();
|
||||||
asArray(safe, prevMath().cell(idx));
|
MathData ar(buffer());
|
||||||
|
asArray(safe, ar);
|
||||||
|
prevMath().cell(idx).insert(0, ar);
|
||||||
editInsertedInset();
|
editInsertedInset();
|
||||||
} else if (t->asMacro() && !safe.empty()) {
|
} else if (t->asMacro() && !safe.empty()) {
|
||||||
MathData ar(buffer());
|
MathData ar(buffer());
|
||||||
|
@ -1844,7 +1844,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
|||||||
if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) {
|
if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) {
|
||||||
MathAtom at = createInsetMath("text", buf);
|
MathAtom at = createInsetMath("text", buf);
|
||||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||||
cur.niceInsert(at);
|
cur.insert(at);
|
||||||
cur.posForward();
|
cur.posForward();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user