forked from qt-creator/qt-creator
TextEditor: Optimize unindent backspace behavior
Only remove more than one character when the cursor is inside the indentation in the beginning of the line. In all other cases always only remove one character. Fixes: QTCREATORBUG-30725 Change-Id: I973101a95768cdd8b1a318972f53423eb72eb157 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: André Hartmann <aha_1980@gmx.de> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -6876,8 +6876,7 @@ void TextEditorWidgetPrivate::handleBackspaceKey()
|
||||
}
|
||||
}
|
||||
} else if (typingSettings.m_smartBackspaceBehavior == TypingSettings::BackspaceUnindents) {
|
||||
const QChar previousChar = q->document()->characterAt(pos - 1);
|
||||
if (!(previousChar == QLatin1Char(' ') || previousChar == QLatin1Char('\t'))) {
|
||||
if (c.positionInBlock() > TabSettings::firstNonSpace(c.block().text())) {
|
||||
if (cursorWithinSnippet)
|
||||
c.beginEditBlock();
|
||||
c.deletePreviousChar();
|
||||
|
Reference in New Issue
Block a user