Commit 29223bc1 authored by hjk's avatar hjk
Browse files

fakevim: more vim-ish cursor positioning after undo/redo



Change-Id: Ie689a719b023ed1e3756470bd144e22b1099bb07
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent 4443532d
......@@ -1485,7 +1485,6 @@ void FakeVimHandler::Private::stopIncrementalFind()
void FakeVimHandler::Private::setUndoPosition(int pos)
{
//qDebug() << " CURSOR POS: " << m_undoCursorPosition;
m_undoCursorPosition[document()->availableUndoSteps()] = pos;
}
......@@ -2893,6 +2892,7 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
moveLeft(qMin(1, leftDist()));
setTargetColumn();
leaveVisualMode();
breakEditBlock();
}
g.dotCommand += m_lastInsertion;
g.dotCommand += QChar(27);
......@@ -2955,11 +2955,13 @@ EventResult FakeVimHandler::Private::handleInsertMode(const Input &input)
setTargetColumn();
m_lastInsertion.clear();
} else if (input.isReturn()) {
joinPreviousEditBlock();
m_submode = NoSubMode;
insertText(QString("\n"));
m_lastInsertion += '\n';
insertAutomaticIndentation(true);
setTargetColumn();
endEditBlock();
} else if (input.isBackspace()) {
joinPreviousEditBlock();
m_justAutoIndented = 0;
......@@ -4835,7 +4837,6 @@ QWidget *FakeVimHandler::Private::editor() const
void FakeVimHandler::Private::undo()
{
//qDebug() << " CURSOR POS: " << m_undoCursorPosition;
// FIXME: That's only an approximaxtion. The real solution might
// be to store marks and old userData with QTextBlock setUserData
// and retrieve them afterward.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment