forked from qt-creator/qt-creator
fakevim: fix indenting
- the indented region has been off by one line as lineForPosition returns 1-based line numbers but QTextDocument::findBlockByNumber expects base 0 - all lines (including first and last line) have to be indented - if text is collapsed, then findBlockByNumber has to be used instead of findBlockByLineNumber for getting the block containing a line Merge-request: 96 Reviewed-by: hjk <qtc-committer@nokia.com>
This commit is contained in:
@@ -2418,7 +2418,8 @@ void FakeVimHandler::Private::indentRegion(QChar typedChar)
|
||||
qSwap(beginLine, endLine);
|
||||
|
||||
int amount = 0;
|
||||
emit q->indentRegion(&amount, beginLine, endLine, typedChar);
|
||||
// lineForPosition has returned 1-based line numbers
|
||||
emit q->indentRegion(&amount, beginLine-1, endLine-1, typedChar);
|
||||
|
||||
setPosition(firstPositionInLine(beginLine));
|
||||
moveToFirstNonBlankOnLine();
|
||||
|
||||
Reference in New Issue
Block a user