mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-23 10:18:50 +00:00
Get raising/lowering into super/subscripts of selection working (1.3
regression) * cursor.C: get rid of paste() * mathed/math_nestinset.C (MathNestInset::doDispatch): (MathNestInset::lfunMouseRelease): define safe_ (selection) in several places (MathNestInset::script): use data member safe_ to insert selection * mathed/math_nestinset.h: data member safe_ git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@13424 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
dba38ca4a7
commit
2c30e9b17a
@ -379,15 +379,6 @@ void LCursor::getPos(int & x, int & y) const
|
||||
}
|
||||
|
||||
|
||||
// Don't use this routine. It is erroneous: LFUN_PASTE should be called with
|
||||
// buffer number, not data to be inserted -- MV 26.02.2006
|
||||
void LCursor::paste(string const & data)
|
||||
{
|
||||
if (!data.empty())
|
||||
dispatch(FuncRequest(LFUN_PASTE, data));
|
||||
}
|
||||
|
||||
|
||||
void LCursor::resetAnchor()
|
||||
{
|
||||
anchor_ = *this;
|
||||
|
@ -712,6 +712,7 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// do superscript if LyX handles
|
||||
// deadkeys
|
||||
recordUndo(cur, Undo::ATOMIC);
|
||||
safe_ = grabAndEraseSelection(cur);
|
||||
script(cur, true);
|
||||
}
|
||||
break;
|
||||
@ -883,12 +884,10 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
|
||||
// math-insert only handles special math things like "matrix".
|
||||
case LFUN_INSERT_MATH: {
|
||||
recordUndo(cur, Undo::ATOMIC);
|
||||
MathArray ar;
|
||||
asArray(cmd.argument, ar);
|
||||
int cell(0);
|
||||
if (cmd.argument == "\\root")
|
||||
cell = 1;
|
||||
cur.niceInsert(cmd.argument);
|
||||
if (cmd.argument == "^" || cmd.argument == "_") {
|
||||
interpret(cur, cmd.argument[0]);
|
||||
} else
|
||||
cur.niceInsert(cmd.argument);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1094,6 +1093,9 @@ void MathNestInset::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
|
||||
bool MathNestInset::interpret(LCursor & cur, char c)
|
||||
{
|
||||
//lyxerr << "interpret 2: '" << c << "'" << endl;
|
||||
if (c == '^' || c == '_')
|
||||
safe_ = grabAndEraseSelection(cur);
|
||||
|
||||
cur.clearTargetX();
|
||||
|
||||
// handle macroMode
|
||||
@ -1246,7 +1248,6 @@ bool MathNestInset::script(LCursor & cur, bool up)
|
||||
}
|
||||
|
||||
cur.macroModeClose();
|
||||
string safe = grabAndEraseSelection(cur);
|
||||
if (asScriptInset() && cur.idx() == 0) {
|
||||
// we are in a nucleus of a script inset, move to _our_ script
|
||||
MathScriptInset * inset = asScriptInset();
|
||||
@ -1277,9 +1278,9 @@ bool MathNestInset::script(LCursor & cur, bool up)
|
||||
cur.idx() = 1;
|
||||
cur.pos() = 0;
|
||||
}
|
||||
//lyxerr << "pasting 1: safe:\n" << safe << endl;
|
||||
cur.paste(safe);
|
||||
//lyxerr << "inserting 1: safe:\n" << safe_ << endl;
|
||||
cur.niceInsert(safe_);
|
||||
cur.resetAnchor();
|
||||
//lyxerr << "pasting 2: safe:\n" << safe << endl;
|
||||
//lyxerr << "inserting 2: safe:\n" << safe_ << endl;
|
||||
return true;
|
||||
}
|
||||
|
@ -128,6 +128,8 @@ protected:
|
||||
cells_type cells_;
|
||||
/// if the inset is locked, it can't be entered with the cursor
|
||||
bool lock_;
|
||||
///
|
||||
std::string safe_;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user