forked from qt-creator/qt-creator
Editor: Fix indenting on the very first position of a document
Task-number: QTCREATORBUG-19294 Change-Id: I3c859d90f0c58165d526b2c9dd9a7afe2abda94b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -128,7 +128,7 @@ QTextCursor TextDocumentPrivate::indentOrUnindent(const QTextCursor &textCursor,
|
|||||||
bool modified = true;
|
bool modified = true;
|
||||||
|
|
||||||
QTextBlock startBlock = m_document.findBlock(start);
|
QTextBlock startBlock = m_document.findBlock(start);
|
||||||
QTextBlock endBlock = m_document.findBlock(blockSelection ? end : end - 1).next();
|
QTextBlock endBlock = m_document.findBlock(blockSelection ? end : qMax(end - 1, 0)).next();
|
||||||
const bool cursorAtBlockStart = (textCursor.position() == startBlock.position());
|
const bool cursorAtBlockStart = (textCursor.position() == startBlock.position());
|
||||||
const bool anchorAtBlockStart = (textCursor.anchor() == startBlock.position());
|
const bool anchorAtBlockStart = (textCursor.anchor() == startBlock.position());
|
||||||
const bool oneLinePartial = (startBlock.next() == endBlock)
|
const bool oneLinePartial = (startBlock.next() == endBlock)
|
||||||
|
Reference in New Issue
Block a user