mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-12-24 13:48:59 +00:00
* InsetMathNest::lfunMouseRelease(): keep the optimization only if there is no selection. This allows to shorten the time when the cursor is initially set at the beginning of the math inset.
* InsetMathNest::lfunMousePress(): Disable optimization introduced in revision 16006. This is because we need the box corners when navigating inside formulas. * InsetMathNest::doDispatch(): ditto. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@16011 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
d67e506396
commit
dd91a7f6b6
@ -493,7 +493,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CHAR_FORWARD:
|
case LFUN_CHAR_FORWARD:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_CHAR_FORWARD_SELECT:
|
case LFUN_CHAR_FORWARD_SELECT:
|
||||||
cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
|
cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
|
||||||
cur.autocorrect() = false;
|
cur.autocorrect() = false;
|
||||||
@ -512,7 +516,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CHAR_BACKWARD:
|
case LFUN_CHAR_BACKWARD:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_CHAR_BACKWARD_SELECT:
|
case LFUN_CHAR_BACKWARD_SELECT:
|
||||||
cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
|
cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
|
||||||
cur.autocorrect() = false;
|
cur.autocorrect() = false;
|
||||||
@ -532,7 +540,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_UP:
|
case LFUN_UP:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_UP_SELECT:
|
case LFUN_UP_SELECT:
|
||||||
// FIXME Tried to use clearTargetX and macroModeClose, crashed on cur.up()
|
// FIXME Tried to use clearTargetX and macroModeClose, crashed on cur.up()
|
||||||
if (cur.inMacroMode()) {
|
if (cur.inMacroMode()) {
|
||||||
@ -550,7 +562,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_DOWN:
|
case LFUN_DOWN:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_DOWN_SELECT:
|
case LFUN_DOWN_SELECT:
|
||||||
if (cur.inMacroMode()) {
|
if (cur.inMacroMode()) {
|
||||||
cur.macroModeClose();
|
cur.macroModeClose();
|
||||||
@ -578,14 +594,22 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_PARAGRAPH_UP:
|
case LFUN_PARAGRAPH_UP:
|
||||||
case LFUN_PARAGRAPH_DOWN:
|
case LFUN_PARAGRAPH_DOWN:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_PARAGRAPH_UP_SELECT:
|
case LFUN_PARAGRAPH_UP_SELECT:
|
||||||
case LFUN_PARAGRAPH_DOWN_SELECT:
|
case LFUN_PARAGRAPH_DOWN_SELECT:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_LINE_BEGIN:
|
case LFUN_LINE_BEGIN:
|
||||||
case LFUN_WORD_BACKWARD:
|
case LFUN_WORD_BACKWARD:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_LINE_BEGIN_SELECT:
|
case LFUN_LINE_BEGIN_SELECT:
|
||||||
case LFUN_WORD_BACKWARD_SELECT:
|
case LFUN_WORD_BACKWARD_SELECT:
|
||||||
cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT ||
|
cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT ||
|
||||||
@ -607,7 +631,11 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
case LFUN_WORD_FORWARD:
|
case LFUN_WORD_FORWARD:
|
||||||
case LFUN_LINE_END:
|
case LFUN_LINE_END:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
case LFUN_WORD_FORWARD_SELECT:
|
case LFUN_WORD_FORWARD_SELECT:
|
||||||
case LFUN_LINE_END_SELECT:
|
case LFUN_LINE_END_SELECT:
|
||||||
cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT ||
|
cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT ||
|
||||||
@ -641,12 +669,20 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CELL_FORWARD:
|
case LFUN_CELL_FORWARD:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
cur.inset().idxNext(cur);
|
cur.inset().idxNext(cur);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LFUN_CELL_BACKWARD:
|
case LFUN_CELL_BACKWARD:
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
cur.inset().idxPrev(cur);
|
cur.inset().idxPrev(cur);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1131,7 +1167,9 @@ void InsetMathNest::lfunMousePress(LCursor & cur, FuncRequest & cmd)
|
|||||||
if (cmd.button() == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
|
//lyxerr << "## lfunMousePress: setting cursor to: " << cur << endl;
|
||||||
bv.mouseSetCursor(cur);
|
bv.mouseSetCursor(cur);
|
||||||
cur.noUpdate();
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset.
|
||||||
|
//cur.noUpdate();
|
||||||
} else if (cmd.button() == mouse_button::button2) {
|
} else if (cmd.button() == mouse_button::button2) {
|
||||||
MathArray ar;
|
MathArray ar;
|
||||||
if (cur.selection())
|
if (cur.selection())
|
||||||
@ -1169,7 +1207,8 @@ void InsetMathNest::lfunMouseRelease(LCursor & cur, FuncRequest & cmd)
|
|||||||
|
|
||||||
if (cmd.button() == mouse_button::button1) {
|
if (cmd.button() == mouse_button::button1) {
|
||||||
//theSelection().put(cur.grabSelection());
|
//theSelection().put(cur.grabSelection());
|
||||||
cur.noUpdate();
|
if (!cur.selection())
|
||||||
|
cur.noUpdate();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1313,22 +1352,33 @@ bool InsetMathNest::interpretChar(LCursor & cur, char_type c)
|
|||||||
// it is better than nothing...
|
// it is better than nothing...
|
||||||
if (!cur.pos() != 0 || cur.prevAtom()->getChar() != ' ') {
|
if (!cur.pos() != 0 || cur.prevAtom()->getChar() != ' ') {
|
||||||
cur.insert(c);
|
cur.insert(c);
|
||||||
cur.updateFlags(Update::SinglePar | Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::SinglePar | Update::FitCursor);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (cur.pos() != 0 && cur.prevAtom()->asSpaceInset()) {
|
if (cur.pos() != 0 && cur.prevAtom()->asSpaceInset()) {
|
||||||
cur.prevAtom().nucleus()->asSpaceInset()->incSpace();
|
cur.prevAtom().nucleus()->asSpaceInset()->incSpace();
|
||||||
cur.updateFlags(Update::SinglePar | Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::SinglePar | Update::FitCursor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cur.popRight()) {
|
if (cur.popRight()) {
|
||||||
cur.updateFlags(Update::FitCursor);
|
// FIXME: we have to enable full redraw here because of the
|
||||||
|
// visual box corners that define the inset. If we know for
|
||||||
|
// sure that we stay within the same cell we can optimize for
|
||||||
|
// that using:
|
||||||
|
//cur.updateFlags(Update::FitCursor);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
cur.updateFlags(Update::FitCursor);
|
|
||||||
// if we are at the very end, leave the formula
|
// if we are at the very end, leave the formula
|
||||||
return cur.pos() != cur.lastpos();
|
return cur.pos() != cur.lastpos();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user