fakevim: Fix block selections

Selection anchor should be in front text cursor position.

Last block with nested block should be selected properly.

Change-Id: I796875ef7bce3527fb703ece5fdf944123f12315
Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
Lukas Holecek
2012-07-20 18:53:44 +02:00
committed by hjk
parent ead1ea2471
commit d4576a4b7a

View File

@@ -4853,7 +4853,8 @@ int FakeVimHandler::Private::blockBoundary(const QString &left,
tc1 = document()->find(begin, tc1, flags); tc1 = document()->find(begin, tc1, flags);
} }
while (level > 0 && (closing ? (tc2 < tc1) : (tc1 < tc2))) { while (level > 0
&& (tc1.isNull() || (closing ? (tc2 < tc1) : (tc1 < tc2)))) {
--level; --level;
tc2 = document()->find(end, tc2, flags); tc2 = document()->find(end, tc2, flags);
if (tc2.isNull()) if (tc2.isNull())
@@ -5158,7 +5159,7 @@ void FakeVimHandler::Private::selectBlockTextObject(bool inner,
p2 -= sright.size() - 1; p2 -= sright.size() - 1;
} }
setAnchorAndPosition(p2, p1); setAnchorAndPosition(p1, p2);
m_movetype = MoveInclusive; m_movetype = MoveInclusive;
} }