Commit 3306cecd authored by Lukas Holecek's avatar Lukas Holecek Committed by hjk
Browse files

fakevim: Fix selectText() with invalid range

If invalid range is passed to selectText() it should return empty

Change-Id: I42ec26fb3dad3f1b521370b1a9596f3d52b92a64
Reviewed-by: default avatarhjk <>
parent 120b932d
......@@ -4627,13 +4627,13 @@ int FakeVimHandler::Private::lastPositionInDocument() const
QString FakeVimHandler::Private::selectText(const Range &range) const
if (range.rangemode == RangeCharMode) {
QTextCursor tc = cursor();
QTextCursor tc(document());
tc.setPosition(range.beginPos, MoveAnchor);
tc.setPosition(range.endPos, KeepAnchor);
return tc.selection().toPlainText();
if (range.rangemode == RangeLineMode) {
QTextCursor tc = cursor();
QTextCursor tc(document());
int firstPos = firstPositionInLine(lineForPosition(range.beginPos));
int lastLine = lineForPosition(range.endPos);
bool endOfDoc = lastLine == document()->lastBlock().blockNumber() + 1;
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