BOOST_ASSERT(cur.text() == this);
BufferView * bv = &cur.bv();
CursorSlice oldTopSlice = cur.top();
+ bool oldBoundary = cur.boundary();
bool sel = cur.selection();
bool needsUpdate = !lyxaction.funcHasFlag(cmd.action, LyXAction::NoUpdate);
case LFUN_RIGHT:
case LFUN_RIGHTSEL:
- lyxerr << BOOST_CURRENT_FUNCTION
- << " LFUN_RIGHT[SEL]:\n" << cur << endl;
+ //lyxerr << BOOST_CURRENT_FUNCTION
+ // << " LFUN_RIGHT[SEL]:\n" << cur << endl;
cur.selHandle(cmd.action == LFUN_RIGHTSEL);
if (isRTL(cur.paragraph()))
needsUpdate = cursorLeft(cur);
else
needsUpdate = cursorRight(cur);
- if (!needsUpdate && oldTopSlice == cur.top()) {
+
+ if (!needsUpdate && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_RIGHT);
}
needsUpdate = cursorRight(cur);
else
needsUpdate = cursorLeft(cur);
- if (oldTopSlice == cur.top()) {
+
+ if (!needsUpdate && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_LEFT);
}
update(cur);
//lyxerr << "handle LFUN_UP[SEL]:\n" << cur << endl;
cur.selHandle(cmd.action == LFUN_UPSEL);
+
needsUpdate = cursorUp(cur);
- if (oldTopSlice == cur.top()) {
+ if (!needsUpdate && oldTopSlice == cur.top()
+ && cur.boundary() == oldBoundary) {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_UP);
}
//lyxerr << "handle LFUN_DOWN[SEL]:\n" << cur << endl;
cur.selHandle(cmd.action == LFUN_DOWNSEL);
needsUpdate = cursorDown(cur);
- if (oldTopSlice == cur.top()) {
+ if (!needsUpdate && oldTopSlice == cur.top() &&
+ cur.boundary() == oldBoundary)
+ {
cur.undispatched();
cmd = FuncRequest(LFUN_FINISHED_DOWN);
}
}
case LFUN_INSET_SETTINGS:
- if (cur.inset().asUpdatableInset())
- cur.inset().asUpdatableInset()->showInsetDialog(bv);
+ cur.inset().showInsetDialog(bv);
break;
case LFUN_NEXT_INSET_TOGGLE: {
break;
case LFUN_GETXY:
- cur.message(convert<string>(cursorX(cur.top())) + ' '
- + convert<string>(cursorY(cur.top())));
+ cur.message(convert<string>(cursorX(cur.top(), cur.boundary())) + ' '
+ + convert<string>(cursorY(cur.top(), cur.boundary())));
break;
case LFUN_SETXY: {
cur.clearSelection();
string const clip = bv->getClipboard();
if (!clip.empty()) {
+ recordUndo(cur);
if (cmd.argument == "paragraph")
insertStringAsParagraphs(cur, clip);
else
int const nargs = s1.empty() ? 0 : convert<int>(s1);
string const s2 = token(s, ' ', 2);
string const type = s2.empty() ? "newcommand" : s2;
- cur.insert(new MathMacroTemplate(token(s, ' ', 0), nargs, s2));
+ cur.insert(new MathMacroTemplate(token(s, ' ', 0), nargs, type));
//cur.nextInset()->edit(cur, true);
}
break;
cur.selection() = false;
} else {
cur.undispatched();
- cmd = FuncRequest(LFUN_FINISHED_LEFT);
+ cmd = FuncRequest(LFUN_FINISHED_RIGHT);
}
break;
default:
- lyxerr << BOOST_CURRENT_FUNCTION
- << " Not DISPATCHED by LyXText" << endl;
+ lyxerr[Debug::ACTION]
+ << BOOST_CURRENT_FUNCTION
+ << ": Command " << cmd
+ << " not DISPATCHED by LyXText" << endl;
cur.undispatched();
break;
}