Commit 64d058a8 authored by hjk's avatar hjk
Browse files

Fixes: fakevim: fix df<x>

    Details:  was broken due to wrong cursor selection approach
parent f73861d4
...@@ -367,6 +367,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev) ...@@ -367,6 +367,7 @@ bool FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
quit(); quit();
return true; return true;
} }
m_mode = CommandMode;
return false; return false;
} }
...@@ -1824,11 +1825,15 @@ void FakeVimHandler::Private::recordEndGroup() ...@@ -1824,11 +1825,15 @@ void FakeVimHandler::Private::recordEndGroup()
QString FakeVimHandler::Private::recordRemoveSelectedText() QString FakeVimHandler::Private::recordRemoveSelectedText()
{ {
EditOperation op; EditOperation op;
//qDebug() << "1 POS: " << position() << " ANCHOR: " << anchor() << m_tc.anchor(); //qDebug() << "POS: " << position() << " ANCHOR: " << anchor() << m_tc.anchor();
m_tc.setPosition(anchor(), KeepAnchor); int pos = m_tc.position();
op.m_position = qMin(position(), anchor()); if (pos == anchor())
//qDebug() << "2 POS: " << position() << " ANCHOR: " << anchor() << m_tc.anchor(); return QString();
m_tc.setPosition(anchor(), MoveAnchor);
m_tc.setPosition(pos, KeepAnchor);
op.m_position = qMin(pos, anchor());
op.m_from = m_tc.selection().toPlainText(); op.m_from = m_tc.selection().toPlainText();
//qDebug() << "OP: " << op;
recordOperation(op); recordOperation(op);
m_tc.deleteChar(); m_tc.deleteChar();
return op.m_from; return op.m_from;
......
Supports Markdown
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