mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-25 10:58:52 +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.
This commit is contained in:
parent
64aad586f4
commit
afb70c905b
@ -518,11 +518,15 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
DocIterator sel_end = cur.selectionEnd();
|
DocIterator sel_end = cur.selectionEnd();
|
||||||
bool multiple_cells = sel_begin.idx() != sel_end.idx();
|
bool multiple_cells = sel_begin.idx() != sel_end.idx();
|
||||||
Font font;
|
Font font;
|
||||||
bool b;
|
|
||||||
font.fromString(to_utf8(arg), b);
|
|
||||||
docstring im;
|
docstring im;
|
||||||
InsetMathFont const * f = asFontInset();
|
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()) {
|
switch(font.fontInfo().family()) {
|
||||||
case ROMAN_FAMILY:
|
case ROMAN_FAMILY:
|
||||||
if (!f || (f->name() != "textrm" && f->name() != "mathrm"))
|
if (!f || (f->name() != "textrm" && f->name() != "mathrm"))
|
||||||
@ -561,7 +565,9 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
im.clear();
|
im.clear();
|
||||||
include_previous_change = true;
|
include_previous_change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support::contains(arg, from_ascii("series"))) {
|
||||||
switch(font.fontInfo().series()) {
|
switch(font.fontInfo().series()) {
|
||||||
case MEDIUM_SERIES:
|
case MEDIUM_SERIES:
|
||||||
if (!f || (f->name() != "textmd" && f->name() != "mathrm"))
|
if (!f || (f->name() != "textmd" && f->name() != "mathrm"))
|
||||||
@ -593,7 +599,9 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
im.clear();
|
im.clear();
|
||||||
include_previous_change = true;
|
include_previous_change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support::contains(arg, from_ascii("shape"))) {
|
||||||
switch(font.fontInfo().shape()) {
|
switch(font.fontInfo().shape()) {
|
||||||
case UP_SHAPE:
|
case UP_SHAPE:
|
||||||
if (!f || (f->name() != "textup" && f->name() != "mathrm"))
|
if (!f || (f->name() != "textup" && f->name() != "mathrm"))
|
||||||
@ -635,7 +643,9 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
im.clear();
|
im.clear();
|
||||||
include_previous_change = true;
|
include_previous_change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (support::contains(arg, from_ascii("size"))) {
|
||||||
switch(font.fontInfo().size()) {
|
switch(font.fontInfo().size()) {
|
||||||
case TINY_SIZE:
|
case TINY_SIZE:
|
||||||
im = from_ascii("tiny");
|
im = from_ascii("tiny");
|
||||||
@ -689,6 +699,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
im.clear();
|
im.clear();
|
||||||
include_previous_change = true;
|
include_previous_change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
InsetMathDecoration const * d = multiple_cells
|
InsetMathDecoration const * d = multiple_cells
|
||||||
? nullptr : asDecorationInset();
|
? nullptr : asDecorationInset();
|
||||||
@ -765,6 +776,7 @@ void InsetMathNest::handleFont2(Cursor & cur, docstring const & arg)
|
|||||||
include_previous_change = true;
|
include_previous_change = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (support::contains(arg, from_ascii("color"))) {
|
||||||
if (font.fontInfo().color() != Color_inherit &&
|
if (font.fontInfo().color() != Color_inherit &&
|
||||||
font.fontInfo().color() != Color_ignore) {
|
font.fontInfo().color() != Color_ignore) {
|
||||||
if (multiple_cells) {
|
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())));
|
handleNest(cur, MathAtom(new InsetMathColor(buffer_, true, font.fontInfo().color())));
|
||||||
include_previous_change = true;
|
include_previous_change = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (selection) {
|
if (selection) {
|
||||||
if (multiple_cells) {
|
if (multiple_cells) {
|
||||||
|
Loading…
Reference in New Issue
Block a user