From: André Pönitz Date: Tue, 28 Aug 2001 13:34:04 +0000 (+0000) Subject: fix cursor font bug X-Git-Tag: 1.6.10~20739 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=6844068ec284172f428c84b64786cae845423076;p=features.git fix cursor font bug git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2606 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/mathed/math_charinset.C b/src/mathed/math_charinset.C index fa9dceba91..28548ba129 100644 --- a/src/mathed/math_charinset.C +++ b/src/mathed/math_charinset.C @@ -31,6 +31,9 @@ MathTextCodes MathCharInset::nativeCode(char c) const { if (isalpha(c)) return LM_TC_VAR; + if (strchr("#$%{|}", c)) + return LM_TC_SPECIAL; + //if (strchr("0123456789;:!|[]().,?+/-*<>=", c) return LM_TC_CONST; } diff --git a/src/mathed/math_cursor.C b/src/mathed/math_cursor.C index 78c45a2d82..124a0ac610 100644 --- a/src/mathed/math_cursor.C +++ b/src/mathed/math_cursor.C @@ -1251,62 +1251,11 @@ void MathCursor::interpret(string const & s) return; } - if (c == '{') { - niceInsert(new MathScopeInset); - return; - } - - if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) { - static char const greek[26] = - {'A', 'B', 'X', 0 , 'E', 0 , 0 , 'H', 'I', 0 , - 'K', 0 , 'M', 'N', 'O', 0 , 0 , 'P', 0 , 'T', - 0, 0, 0, 0, 0 , 'Z' }; - - MathTextCodes code = LM_TC_SYMB; - if ('A' <= c && c <= 'Z' && greek[c - 'A']) { - code = LM_TC_RM; - c = greek[c - 'A']; - } - insert(c, code); - -#warning greek insert problem? look here! - //if (lastcode_ == LM_TC_GREEK1) - lastcode_ = LM_TC_VAR; - return; - } - if (selection_) selDel(); - if (lastcode_ == LM_TC_TEX) { - if (macroName().empty()) { - insert(c, LM_TC_TEX); - if (!isalpha(c)) { - macroModeClose(); - lastcode_ = LM_TC_VAR; - } - } else { - if (isalpha(c)) - insert(c, LM_TC_TEX); - else { - macroModeClose(); - lastcode_ = LM_TC_VAR; - } - } - return; - } - - if (strchr("0123456789;:!|[]().,?+/-*<>=", c)) { - if (lastcode_ != LM_TC_TEXTRM) - lastcode_ = LM_TC_CONST; - insert(c, lastcode_); - return; - } - - if (strchr("#$%{|}", c)) { - if (lastcode_ != LM_TC_TEXTRM) - lastcode_ = LM_TC_SPECIAL; - insert(c, lastcode_); + if (lastcode_ == LM_TC_TEXTRM) { + insert(c, LM_TC_TEXTRM); return; } @@ -1323,11 +1272,6 @@ void MathCursor::interpret(string const & s) return; } - if (lastcode_ == LM_TC_TEXTRM) { - insert(c, LM_TC_TEXTRM); - return; - } - if (mathcursor->popRight()) return; @@ -1338,22 +1282,59 @@ void MathCursor::interpret(string const & s) return; } - if (c == '\'' || c == '@') { - insert(c, LM_TC_VAR); + if (lastcode_ == LM_TC_TEX) { + if (macroName().empty()) { + insert(c, LM_TC_TEX); + if (!isalpha(c)) { + macroModeClose(); + lastcode_ = LM_TC_VAR; + } + } else { + if (isalpha(c)) + insert(c, LM_TC_TEX); + else { + macroModeClose(); + lastcode_ = LM_TC_VAR; + } + } return; } - if (c == '\\') { - lastcode_ = LM_TC_TEX; - //bv->owner()->message(_("TeX mode")); + if (c == '{') { + niceInsert(new MathScopeInset); + return; + } + + if (c == '}') // ignore it + return; + + if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) { + static char const greek[26] = + {'A', 'B', 'X', 0 , 'E', 0 , 0 , 'H', 'I', 0 , + 'K', 0 , 'M', 'N', 'O', 0 , 0 , 'P', 0 , 'T', + 0, 0, 0, 0, 0 , 'Z' }; + + MathTextCodes code = LM_TC_SYMB; + if ('A' <= c && c <= 'Z' && greek[c - 'A']) { + code = LM_TC_RM; + c = greek[c - 'A']; + } + insert(c, code); + +#warning greek insert problem? look here! + //if (lastcode_ == LM_TC_GREEK1) + lastcode_ = LM_TC_VAR; return; } - if (isalpha(c)) { - insert(c, lastcode_); + if (c == '\\') { + lastcode_ = LM_TC_TEX; + //bv->owner()->message(_("TeX mode")); return; } + // no special circumstances, so insert the character without any fuss + insert(c); } diff --git a/src/mathed/texify b/src/mathed/texify index c4dad63ebc..3df99f0291 100755 --- a/src/mathed/texify +++ b/src/mathed/texify @@ -4,7 +4,8 @@ # a given macro. # # Call it with texify '\macro' [...] to get a line per item giving ascent, -# descent, width and the primitives that TeX would use to typeset the item +# descent, width, the font and the position in the font TeX would use to +# typeset the symbol. # Original script: #\batchmode @@ -42,7 +43,9 @@ foreach item $::argv { set f [open $filebase.log r] while {![eof $f]} { gets $f line + # try to interpret it as a hbox line regexp $hboxexp $line dummy ascent descent width + # try to interpret it as a font line regexp $fontexp $line dummy font char } close $f