void specialChar(Cursor & cur, InsetSpecialChar::Kind kind)
{
+ recordUndo(cur);
cap::replaceSelection(cur);
cur.insert(new InsetSpecialChar(kind));
cur.posRight();
//lyxerr << BOOST_CURRENT_FUNCTION
// << " LFUN_CHAR_FORWARD[SEL]:\n" << cur << endl;
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_FORWARD_SELECT);
- if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+ if (reverseDirectionNeeded(cur))
needsUpdate |= cursorLeft(cur);
else
needsUpdate |= cursorRight(cur);
case LFUN_CHAR_BACKWARD_SELECT:
//lyxerr << "handle LFUN_CHAR_BACKWARD[_SELECT]:\n" << cur << endl;
needsUpdate |= cur.selHandle(cmd.action == LFUN_CHAR_BACKWARD_SELECT);
- if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+ if (reverseDirectionNeeded(cur))
needsUpdate |= cursorRight(cur);
else
needsUpdate |= cursorLeft(cur);
case LFUN_WORD_FORWARD:
case LFUN_WORD_FORWARD_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_WORD_FORWARD_SELECT);
- if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+ if (reverseDirectionNeeded(cur))
needsUpdate |= cursorLeftOneWord(cur);
else
needsUpdate |= cursorRightOneWord(cur);
case LFUN_WORD_BACKWARD:
case LFUN_WORD_BACKWARD_SELECT:
needsUpdate |= cur.selHandle(cmd.action == LFUN_WORD_BACKWARD_SELECT);
- if (isRTL(*cur.bv().buffer(), cur.paragraph()))
+ if (reverseDirectionNeeded(cur))
needsUpdate |= cursorRightOneWord(cur);
else
needsUpdate |= cursorLeftOneWord(cur);
case LFUN_MATH_BIGDELIM: {
cur.insert(new InsetMathHull(hullSimple));
cur.dispatch(FuncRequest(LFUN_CHAR_FORWARD));
+ BOOST_ASSERT(cur.inMathed());
cur.dispatch(cmd);
break;
}
case LFUN_FINISHED_LEFT:
LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_LEFT:\n" << cur << endl;
+ if (reverseDirectionNeeded(cur))
+ ++cur.pos();
break;
case LFUN_FINISHED_RIGHT:
LYXERR(Debug::DEBUG) << "handle LFUN_FINISHED_RIGHT:\n" << cur << endl;
- ++cur.pos();
+ if (!reverseDirectionNeeded(cur))
+ ++cur.pos();
break;
case LFUN_FINISHED_UP: