mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 11:16:55 +00:00
Introduce a helper function and use it.
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@29130 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
0de1e7730f
commit
3e341497a8
@ -1617,7 +1617,7 @@ bool InsetMathNest::interpretChar(Cursor & cur, char_type const c)
|
||||
cur.niceInsert(createInsetMath("sim"));
|
||||
return true;
|
||||
}
|
||||
if (c >= 0x80 && !Encodings::isMathAlpha(c)) {
|
||||
if (!isAsciiOrMathAlpha(c)) {
|
||||
MathAtom at = createInsetMath("text");
|
||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||
cur.niceInsert(at);
|
||||
|
@ -513,4 +513,10 @@ bool createInsetMath_fromDialogStr(docstring const & str, MathData & ar)
|
||||
}
|
||||
|
||||
|
||||
bool isAsciiOrMathAlpha(char_type c)
|
||||
{
|
||||
return c < 0x80 || Encodings::isMathAlpha(c);
|
||||
}
|
||||
|
||||
|
||||
} // namespace lyx
|
||||
|
@ -33,6 +33,11 @@ MathAtom createInsetMath(char const * const);
|
||||
*/
|
||||
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;
|
||||
MathWordList const & mathedWordList();
|
||||
|
||||
|
@ -909,17 +909,16 @@ bool Parser::parse1(InsetMathGrid & grid, unsigned flags,
|
||||
|
||||
else if (t.cat() == catOther) {
|
||||
char_type c = t.character();
|
||||
if (c < 0x80 || mode_ & Parse::VERBATIM
|
||||
if (isAsciiOrMathAlpha(c)
|
||||
|| mode_ & Parse::VERBATIM
|
||||
|| !(mode_ & Parse::USETEXT)
|
||||
|| mode == InsetMath::TEXT_MODE
|
||||
|| Encodings::isMathAlpha(c)) {
|
||||
|| mode == InsetMath::TEXT_MODE) {
|
||||
cell->push_back(MathAtom(new InsetMathChar(c)));
|
||||
} else {
|
||||
MathAtom at = createInsetMath("text");
|
||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||
while (nextToken().cat() == catOther
|
||||
&& nextToken().character() >= 0x80
|
||||
&& !Encodings::isMathAlpha(nextToken().character())) {
|
||||
&& !isAsciiOrMathAlpha(nextToken().character())) {
|
||||
c = getToken().character();
|
||||
at.nucleus()->cell(0).push_back(MathAtom(new InsetMathChar(c)));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user