mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 01:59:02 +00:00
Fix textstyle-update handling in mathed
The code was expecting that all properties were specified
in the argument and not only some. Simply do not process
those properties not specified in the argument.
(cherry picked from commit afb70c905b
)
This commit is contained in:
parent
5a69b8a184
commit
4acc6e36e3
@ -518,11 +518,15 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
DocIterator sel_end = cur.selectionEnd();
|
||||
bool multiple_cells = sel_begin.idx() != sel_end.idx();
|
||||
Font font;
|
||||
bool b;
|
||||
font.fromString(to_utf8(arg), b);
|
||||
docstring im;
|
||||
InsetMathFont const * f = asFontInset();
|
||||
bool b;
|
||||
|
||||
// Return if nothing has been set
|
||||
if (!font.fromString(to_utf8(arg), b))
|
||||
return;
|
||||
|
||||
if (support::contains(arg, from_ascii("family"))) {
|
||||
switch(font.fontInfo().family()) {
|
||||
case ROMAN_FAMILY:
|
||||
if (!f || (f->name() != "textrm" && f->name() != "mathrm"))
|
||||
@ -561,7 +565,9 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
im.clear();
|
||||
include_previous_change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (support::contains(arg, from_ascii("series"))) {
|
||||
switch(font.fontInfo().series()) {
|
||||
case MEDIUM_SERIES:
|
||||
if (!f || (f->name() != "textmd" && f->name() != "mathrm"))
|
||||
@ -593,7 +599,9 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
im.clear();
|
||||
include_previous_change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (support::contains(arg, from_ascii("shape"))) {
|
||||
switch(font.fontInfo().shape()) {
|
||||
case UP_SHAPE:
|
||||
if (!f || (f->name() != "textup" && f->name() != "mathrm"))
|
||||
@ -635,7 +643,9 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
im.clear();
|
||||
include_previous_change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (support::contains(arg, from_ascii("size"))) {
|
||||
switch(font.fontInfo().size()) {
|
||||
case TINY_SIZE:
|
||||
im = from_ascii("tiny");
|
||||
@ -689,6 +699,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
im.clear();
|
||||
include_previous_change = true;
|
||||
}
|
||||
}
|
||||
|
||||
InsetMathDecoration const * d = multiple_cells
|
||||
? nullptr : asDecorationInset();
|
||||
@ -765,6 +776,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
include_previous_change = true;
|
||||
}
|
||||
|
||||
if (support::contains(arg, from_ascii("color"))) {
|
||||
if (font.fontInfo().color() != Color_inherit &&
|
||||
font.fontInfo().color() != Color_ignore) {
|
||||
if (multiple_cells) {
|
||||
@ -781,6 +793,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
||||
handleNest(cur, MathAtom(new InsetMathColor(buffer_, true, font.fontInfo().color())));
|
||||
include_previous_change = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (selection) {
|
||||
if (multiple_cells) {
|
||||
|
Loading…
Reference in New Issue
Block a user