mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
When inserting text character in mathed, group in same \text when possible.
When inserting € in a math cell, it is put in a text inset and the cursor leaves the inset. However, inserting ¤ then leads to \text{€}\text{¤}. Therefore, try to see if there is a previous \text inset that can be recycled and insert the new inset there in this case, leading to \text{€¤}. Fixes bug #11979.
This commit is contained in:
parent
e522c5444e
commit
5eecfa3e04
@ -1903,10 +1903,16 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
||||
return true;
|
||||
}
|
||||
if (currentMode() == InsetMath::MATH_MODE && Encodings::isUnicodeTextOnly(c)) {
|
||||
MathAtom at = createInsetMath("text", buf);
|
||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||
cur.insert(at);
|
||||
cur.posForward();
|
||||
MathAtom const atom(new InsetMathChar(c));
|
||||
if (cur.prevInset() && cur.prevInset()->asInsetMath()->name() == "text") {
|
||||
// reuse existing \text inset
|
||||
cur.prevInset()->asInsetMath()->cell(0).push_back(atom);
|
||||
} else {
|
||||
MathAtom at = createInsetMath("text", buf);
|
||||
at.nucleus()->cell(0).push_back(atom);
|
||||
cur.insert(at);
|
||||
cur.posForward();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
|
Loading…
Reference in New Issue
Block a user