summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKai Koehne <kai.koehne@nokia.com>2009-07-16 14:53:41 +1000
committerKai Koehne <kai.koehne@nokia.com>2009-07-16 14:53:41 +1000
commit1f525f929d180dfef4d008a2a231ff7cc3c06a53 (patch)
tree994568050b08e1d13a4c88797122d5dbf8772150 /src
parent05b474abfcd90013994d51a47e79169cab8ad39e (diff)
downloadqt-creator-1f525f929d180dfef4d008a2a231ff7cc3c06a53.tar.gz
Fix auto-indentation for dui editor
This patch should fix auto-indentation (Ctrl+I) for the most usual cases. Before this patch, lines were never dedented, resulting in e.g. Rect { Item { } Item { }
Diffstat (limited to 'src')
-rw-r--r--src/plugins/duieditor/duieditor.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/plugins/duieditor/duieditor.cpp b/src/plugins/duieditor/duieditor.cpp
index 9300ba45f3..58624f5561 100644
--- a/src/plugins/duieditor/duieditor.cpp
+++ b/src/plugins/duieditor/duieditor.cpp
@@ -617,8 +617,10 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedCha
{
TextEditor::TabSettings ts = tabSettings();
- if (typedChar == QLatin1Char('}')) {
- QTextCursor tc = textCursor();
+ if (typedChar == QLatin1Char('}')
+ || ((typedChar == QChar::Null) && block.text().trimmed() == "}")) {
+
+ QTextCursor tc(block);
if (TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tc)) {
const QString text = tc.block().text();
int indent = ts.columnAt(text, ts.firstNonSpace(text));