Commit a298a0c3 authored by Leandro Melo's avatar Leandro Melo Committed by Leandro T. C. Melo

Editor: Unindent backpace mode should not apply for parag. separators

QChar:isSpace also includes paragraph separator, for which the backspace
behavior should be the normal one.

Change-Id: I80c362a4e11b436259f85fea4c73de874fc64249
Reviewed-on: http://codereview.qt-project.org/5389Reviewed-by: default avatarQt Sanity Bot <qt_sanity_bot@ovi.com>
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent b724ec84
......@@ -4513,9 +4513,12 @@ void BaseTextEditorWidget::handleHomeKey(bool anchor)
void BaseTextEditorWidget::handleBackspaceKey()
{
QTextCursor cursor = textCursor();
int pos = cursor.position();
QTC_ASSERT(!cursor.hasSelection(), return);
const int pos = cursor.position();
if (!pos)
return;
bool cursorWithinSnippet = false;
if (d->m_snippetOverlay->isVisible()) {
QTextCursor snippetCursor = cursor;
......@@ -4570,7 +4573,8 @@ void BaseTextEditorWidget::handleBackspaceKey()
}
}
} else if (tabSettings.m_smartBackspaceBehavior == TabSettings::BackspaceUnindents) {
if (!pos || !characterAt(pos - 1).isSpace()) {
const QChar &c = characterAt(pos - 1);
if (!(c == QLatin1Char(' ') || c == QLatin1Char('\t'))) {
if (cursorWithinSnippet)
cursor.beginEditBlock();
cursor.deletePreviousChar();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment