Fixes: fakevim: fix df<x>

Details:  was broken due to wrong cursor selection approach
This commit is contained in:
hjk
2009-01-21 16:04:34 +01:00
parent f73861d458
commit 64d058a81b

View File

@@ -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()
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;