Make [ start a block and trigger indentation in the qml editor.

Reviewed-by: erikv
This commit is contained in:
Christian Kamm
2009-10-02 15:06:50 +02:00
parent 5a73440b18
commit 0cc5f14f29
3 changed files with 28 additions and 14 deletions

View File

@@ -628,7 +628,8 @@ QString ScriptEditor::wordUnderCursor() const
bool ScriptEditor::isElectricCharacter(const QChar &ch) const
{
if (ch == QLatin1Char('}'))
if (ch == QLatin1Char('}')
|| ch == QLatin1Char(']'))
return true;
return false;
}
@@ -637,12 +638,13 @@ void ScriptEditor::indentBlock(QTextDocument *, QTextBlock block, QChar typedCha
{
TextEditor::TabSettings ts = tabSettings();
if (typedChar == QLatin1Char('}')
|| ((typedChar == QChar::Null) && block.text().trimmed() == "}")) {
if (typedChar == QLatin1Char('}') || typedChar == QLatin1Char(']')
|| (typedChar == QChar::Null
&& (block.text().trimmed() == "}" || block.text().trimmed() == "]"))) {
QTextCursor tc(block);
if (typedChar == QLatin1Char('}'))
if (typedChar == QLatin1Char('}') || typedChar == QLatin1Char(']'))
tc = textCursor();
if (TextEditor::TextBlockUserData::findPreviousBlockOpenParenthesis(&tc)) {