mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
^ now copies selection into new scriptinset
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@2324 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fd054e60b1
commit
c1bd906202
@ -8,6 +8,8 @@
|
||||
|
||||
* formulabase.C: fix memory leak
|
||||
|
||||
* math_cursor.C: ^ now copies selection into new srriptinset
|
||||
|
||||
2001-07-22 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
|
||||
|
||||
* formula.C (insetAllowed): allow insertion of label
|
||||
|
@ -151,15 +151,15 @@ void MathArray::setCode(int pos, MathTextCodes t)
|
||||
}
|
||||
|
||||
|
||||
void MathArray::insert(int pos, MathInset * p)
|
||||
void MathArray::replace(int pos, MathInset * p)
|
||||
{
|
||||
bf_.insert(bf_.begin() + pos, 2 + sizeof(p), LM_TC_INSET);
|
||||
memcpy(&bf_[pos + 1], &p, sizeof(p));
|
||||
}
|
||||
|
||||
|
||||
void MathArray::replace(int pos, MathInset * p)
|
||||
void MathArray::insert(int pos, MathInset * p)
|
||||
{
|
||||
bf_.insert(bf_.begin() + pos, 2 + sizeof(p), LM_TC_INSET);
|
||||
memcpy(&bf_[pos + 1], &p, sizeof(p));
|
||||
}
|
||||
|
||||
|
@ -628,29 +628,23 @@ void MathCursor::Interpret(string const & s)
|
||||
lyxerr << "Interpret: '" << s << "' ('" << s.substr(0, 7) << "' " <<
|
||||
in_word_set(s) << " \n";
|
||||
|
||||
if (s[0] == '^') {
|
||||
MathUpDownInset * p = nearbyUpDownInset();
|
||||
if (s[0] == '^' || s[0] == '_') {
|
||||
bool const up = (s[0] == '^');
|
||||
SelCut();
|
||||
MathUpDownInset * p = prevUpDownInset();
|
||||
if (!p) {
|
||||
p = new MathScriptInset(true, false);
|
||||
p = new MathScriptInset(up, !up);
|
||||
insert(p);
|
||||
plainLeft();
|
||||
}
|
||||
push(p, true);
|
||||
if (up)
|
||||
p->up(true);
|
||||
cursor().idx_ = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (s[0] == '_') {
|
||||
MathUpDownInset * p = nearbyUpDownInset();
|
||||
if (!p) {
|
||||
p = new MathScriptInset(false, true);
|
||||
insert(p);
|
||||
plainLeft();
|
||||
}
|
||||
push(p, true);
|
||||
else
|
||||
p->down(true);
|
||||
cursor().idx_ = 1;
|
||||
cursor().idx_ = up ? 0 : 1;
|
||||
cursor().pos_ = 0;
|
||||
SelPaste();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1103,16 +1097,11 @@ MathInset * MathCursor::nextInset() const
|
||||
}
|
||||
|
||||
|
||||
MathUpDownInset * MathCursor::nearbyUpDownInset() const
|
||||
MathUpDownInset * MathCursor::prevUpDownInset() const
|
||||
{
|
||||
normalize();
|
||||
MathInset * p = array().prevInset(cursor().pos_);
|
||||
if (p && p->isUpDownInset())
|
||||
return static_cast<MathUpDownInset *>(p);
|
||||
//p = array().nextInset(cursor().pos_);
|
||||
//if (p && p->isUpDownInset())
|
||||
// return static_cast<MathUpDownInset *>(p);
|
||||
return 0;
|
||||
return (p && p->isUpDownInset()) ? static_cast<MathUpDownInset *>(p) : 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -258,7 +258,7 @@ public:
|
||||
///
|
||||
MathInset * prevInset() const;
|
||||
///
|
||||
MathUpDownInset * nearbyUpDownInset() const;
|
||||
MathUpDownInset * prevUpDownInset() const;
|
||||
|
||||
///
|
||||
MathFuncInset * imacro;
|
||||
|
Loading…
Reference in New Issue
Block a user