fakevim: fix moving to first non-blank on a line

if there are only blanks, first non-blank on line is the last position

Merge-request: 99
Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
Martin Aumüller
2010-01-21 17:38:25 +01:00
committed by hjk
parent b324a7b789
commit b0991bd22c

View File

@@ -2472,7 +2472,7 @@ void FakeVimHandler::Private::moveToFirstNonBlankOnLine()
const QTextBlock &block = m_tc.block();
int firstPos = block.position();
for (int i = firstPos, n = firstPos + block.length(); i < n; ++i) {
if (!doc->characterAt(i).isSpace()) {
if (!doc->characterAt(i).isSpace() || i == n - 1) {
setPosition(i);
return;
}