From b932615ca0c2ee07a828b669f81b09392a92806a Mon Sep 17 00:00:00 2001 From: mae <qt-info@nokia.com> Date: Thu, 28 Jan 2010 16:27:57 +0100 Subject: [PATCH] fix smart backspace handling The smart backspace handling required a preceeding non empty text block. In this case, the fix introduces a standard backspace (deletePreviousCharacter). Reviewed-by: dt --- src/plugins/texteditor/basetexteditor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/basetexteditor.cpp b/src/plugins/texteditor/basetexteditor.cpp index a74e40cbe85..94f4f6e5c3b 100644 --- a/src/plugins/texteditor/basetexteditor.cpp +++ b/src/plugins/texteditor/basetexteditor.cpp @@ -3749,9 +3749,10 @@ void BaseTextEditor::handleBackspaceKey() cursor.setPosition(currentBlock.position(), QTextCursor::KeepAnchor); cursor.insertText(tabSettings.indentationString(previousNonEmptyBlockText)); cursor.endEditBlock(); - break; + return; } } + cursor.deletePreviousChar(); } void BaseTextEditor::wheelEvent(QWheelEvent *e) @@ -3918,6 +3919,8 @@ bool BaseTextEditor::autoBackspace(QTextCursor &cursor) d->m_allowSkippingOfBlockEnd = false; int pos = cursor.position(); + if (pos == 0) + return false; QTextCursor c = cursor; c.setPosition(pos - 1); -- GitLab