forked from qt-creator/qt-creator
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/5389 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
committed by
Leandro T. C. Melo
parent
b724ec84d1
commit
a298a0c306
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user