mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-14 01:22:33 +00:00
Introduce a helper function and use it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_6_X@29145 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
a67a5bf598
commit
b59d7f44d6
@ -1598,7 +1598,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type c)
|
|||||||
cur.niceInsert(createInsetMath("sim"));
|
cur.niceInsert(createInsetMath("sim"));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (c >= 0x80 && !Encodings::isMathAlpha(c)) {
|
if (!isAsciiOrMathAlpha(c)) {
|
||||||
MathAtom at = createInsetMath("text");
|
MathAtom at = createInsetMath("text");
|
||||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||||
cur.niceInsert(at);
|
cur.niceInsert(at);
|
||||||
|
@ -505,4 +505,10 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool isAsciiOrMathAlpha(char_type c)
|
||||||
|
{
|
||||||
|
return c < 0x80 || Encodings::isMathAlpha(c);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
} // namespace lyx
|
} // namespace lyx
|
||||||
|
@ -33,6 +33,11 @@ MathAtom createInsetMath(char const * const);
|
|||||||
*/
|
*/
|
||||||
bool createInsetMath_fromDialogStr(docstring const &, MathData &);
|
bool createInsetMath_fromDialogStr(docstring const &, MathData &);
|
||||||
|
|
||||||
|
/** Tells whether the argument is an ascii character or is marked as
|
||||||
|
* mathalpha in the unicodesymbols file.
|
||||||
|
*/
|
||||||
|
bool isAsciiOrMathAlpha(char_type);
|
||||||
|
|
||||||
typedef std::map<docstring, latexkeys> MathWordList;
|
typedef std::map<docstring, latexkeys> MathWordList;
|
||||||
MathWordList const & mathedWordList();
|
MathWordList const & mathedWordList();
|
||||||
|
|
||||||
|
@ -909,17 +909,16 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
|||||||
|
|
||||||
else if (t.cat() == catOther) {
|
else if (t.cat() == catOther) {
|
||||||
char_type c = t.character();
|
char_type c = t.character();
|
||||||
if (c < 0x80 || mode_ & Parse::VERBATIM
|
if (isAsciiOrMathAlpha(c)
|
||||||
|
|| mode_ & Parse::VERBATIM
|
||||||
|| !(mode_ & Parse::USETEXT)
|
|| !(mode_ & Parse::USETEXT)
|
||||||
|| mode == InsetMath::TEXT_MODE
|
|| mode == InsetMath::TEXT_MODE) {
|
||||||
|| Encodings::isMathAlpha(c)) {
|
|
||||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
cell->push_back(MathAtom(new InsetMathChar(c)));
|
||||||
} else {
|
} else {
|
||||||
MathAtom at = createInsetMath("text");
|
MathAtom at = createInsetMath("text");
|
||||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||||
while (nextToken().cat() == catOther
|
while (nextToken().cat() == catOther
|
||||||
&& nextToken().character() >= 0x80
|
&& !isAsciiOrMathAlpha(nextToken().character())) {
|
||||||
&& !Encodings::isMathAlpha(nextToken().character())) {
|
|
||||||
c = getToken().character();
|
c = getToken().character();
|
||||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user