mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-26 03:11:59 +00:00
leave red backslash as visual clue in formula when typing macro names
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2833 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d2a9294e3f
commit
c5e13278e7
@ -1,3 +1,11 @@
|
|||||||
|
|
||||||
|
2001-10-02 André Pönitz <poenitz@gmx.net>
|
||||||
|
|
||||||
|
* math_cursor.C: leave red backslash as visual clue
|
||||||
|
in formula when typing macro names
|
||||||
|
|
||||||
|
* math_macrotemplate.C: sanity check
|
||||||
|
|
||||||
2001-10-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
2001-10-01 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
|
||||||
|
|
||||||
* math_cursor.C:
|
* math_cursor.C:
|
||||||
|
@ -635,8 +635,8 @@ void MathCursor::macroModeClose()
|
|||||||
{
|
{
|
||||||
string s = macroName();
|
string s = macroName();
|
||||||
if (s.size()) {
|
if (s.size()) {
|
||||||
pos() = pos() - s.size();
|
pos() = pos() - s.size() - 1;
|
||||||
for (unsigned i = 0; i < s.size(); ++i)
|
for (unsigned i = 0; i <= s.size(); ++i)
|
||||||
plainErase();
|
plainErase();
|
||||||
lastcode_ = LM_TC_VAR;
|
lastcode_ = LM_TC_VAR;
|
||||||
interpret("\\" + s);
|
interpret("\\" + s);
|
||||||
@ -649,10 +649,9 @@ string MathCursor::macroName() const
|
|||||||
string s;
|
string s;
|
||||||
for (int i = pos() - 1; i >= 0; --i) {
|
for (int i = pos() - 1; i >= 0; --i) {
|
||||||
MathInset * p = array().at(i)->nucleus();
|
MathInset * p = array().at(i)->nucleus();
|
||||||
if (p && p->code() == LM_TC_TEX)
|
if (!p || p->code() != LM_TC_TEX || p->getChar() == '\\')
|
||||||
s = p->getChar() + s;
|
|
||||||
else
|
|
||||||
break;
|
break;
|
||||||
|
s = p->getChar() + s;
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -1333,11 +1332,6 @@ void MathCursor::interpret(string const & s)
|
|||||||
|
|
||||||
if (lastcode_ == LM_TC_TEX) {
|
if (lastcode_ == LM_TC_TEX) {
|
||||||
if (macroName().empty()) {
|
if (macroName().empty()) {
|
||||||
if (strchr("$%{}", c)) {
|
|
||||||
insert(new MathCharInset(c, LM_TC_TEX));
|
|
||||||
lastcode_ = LM_TC_VAR;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
insert(c, LM_TC_TEX);
|
insert(c, LM_TC_TEX);
|
||||||
if (!isalpha(c) && c != '#') {
|
if (!isalpha(c) && c != '#') {
|
||||||
macroModeClose();
|
macroModeClose();
|
||||||
@ -1362,14 +1356,14 @@ void MathCursor::interpret(string const & s)
|
|||||||
if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) {
|
if (isalpha(c) && (lastcode_ == LM_TC_GREEK || lastcode_ == LM_TC_GREEK1)) {
|
||||||
static char const greekl[][26] =
|
static char const greekl[][26] =
|
||||||
{"alpha", "beta", "chi", "delta", "epsilon", "phi",
|
{"alpha", "beta", "chi", "delta", "epsilon", "phi",
|
||||||
"gamma", "eta", "iota", "", "kappa", "lambda", "mu",
|
"gamma", "eta", "iota", "iota", "kappa", "lambda", "mu",
|
||||||
"nu", "omikron", "pi", "omega", "rho", "sigma",
|
"nu", "omikron", "pi", "omega", "rho", "sigma",
|
||||||
"tau", "upsilon", "theta", "", "xi", "upsilon", "zeta"};
|
"tau", "upsilon", "theta", "omega", "xi", "upsilon", "zeta"};
|
||||||
static char const greeku[][26] =
|
static char const greeku[][26] =
|
||||||
{"Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi",
|
{"Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi",
|
||||||
"Gamma", "Eta", "Iota", "", "Kappa", "Lambda", "Mu",
|
"Gamma", "Eta", "Iota", "Iota", "Kappa", "Lambda", "Mu",
|
||||||
"Nu", "Omikron", "Pi", "Omega", "Rho", "Sigma", "Tau",
|
"Nu", "Omikron", "Pi", "Omega", "Rho", "Sigma", "Tau",
|
||||||
"Upsilon", "Theta", "", "xi", "Upsilon", "Zeta"};
|
"Upsilon", "Theta", "Omega", "xi", "Upsilon", "Zeta"};
|
||||||
|
|
||||||
latexkeys const * l = 0;
|
latexkeys const * l = 0;
|
||||||
if ('a' <= c && c <= 'z')
|
if ('a' <= c && c <= 'z')
|
||||||
@ -1390,6 +1384,7 @@ void MathCursor::interpret(string const & s)
|
|||||||
|
|
||||||
if (c == '\\') {
|
if (c == '\\') {
|
||||||
lastcode_ = LM_TC_TEX;
|
lastcode_ = LM_TC_TEX;
|
||||||
|
insert(c, LM_TC_TEX);
|
||||||
//bv->owner()->message(_("TeX mode"));
|
//bv->owner()->message(_("TeX mode"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ MathMacroTemplate::MathMacroTemplate()
|
|||||||
MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
|
MathMacroTemplate::MathMacroTemplate(string const & nm, int numargs)
|
||||||
: MathNestInset(1), numargs_(numargs), name_(nm)
|
: MathNestInset(1), numargs_(numargs), name_(nm)
|
||||||
{
|
{
|
||||||
if (numargs_ < 1 || numargs_ > 9) {
|
if (numargs_ > 9) {
|
||||||
lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
|
lyxerr << "MathMacroTemplate::MathMacroTemplate: wrong # of arguments: "
|
||||||
<< numargs_ << std::endl;
|
<< numargs_ << std::endl;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user