Commit 9f737301 authored by Christian Kamm's avatar Christian Kamm
Browse files

Editor: Fix finding block parentheses.



The '[' and ']' characters were considered block-opening/closing. That
led to bad results in the autocompleter (the only user of these
functions).

Task-number: QTCREATORBUG-8031
Change-Id: I81b464b2591d3695baad6e9630f9bcc4aa4ef795
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 9f1d8b66
...@@ -390,8 +390,7 @@ bool TextBlockUserData::findPreviousBlockOpenParenthesis(QTextCursor *cursor, bo ...@@ -390,8 +390,7 @@ bool TextBlockUserData::findPreviousBlockOpenParenthesis(QTextCursor *cursor, bo
for (int i = parenList.count()-1; i >= 0; --i) { for (int i = parenList.count()-1; i >= 0; --i) {
Parenthesis paren = parenList.at(i); Parenthesis paren = parenList.at(i);
if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}') if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}')
&& paren.chr != QLatin1Char('+') && paren.chr != QLatin1Char('-') && paren.chr != QLatin1Char('+') && paren.chr != QLatin1Char('-'))
&& paren.chr != QLatin1Char('[') && paren.chr != QLatin1Char(']'))
continue; continue;
if (block == cursor->block()) { if (block == cursor->block()) {
if (position - block.position() <= paren.pos + (paren.type == Parenthesis::Closed ? 1 : 0)) if (position - block.position() <= paren.pos + (paren.type == Parenthesis::Closed ? 1 : 0))
...@@ -454,8 +453,7 @@ bool TextBlockUserData::findNextBlockClosingParenthesis(QTextCursor *cursor) ...@@ -454,8 +453,7 @@ bool TextBlockUserData::findNextBlockClosingParenthesis(QTextCursor *cursor)
for (int i = 0; i < parenList.count(); ++i) { for (int i = 0; i < parenList.count(); ++i) {
Parenthesis paren = parenList.at(i); Parenthesis paren = parenList.at(i);
if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}') if (paren.chr != QLatin1Char('{') && paren.chr != QLatin1Char('}')
&& paren.chr != QLatin1Char('+') && paren.chr != QLatin1Char('-') && paren.chr != QLatin1Char('+') && paren.chr != QLatin1Char('-'))
&& paren.chr != QLatin1Char('[') && paren.chr != QLatin1Char(']'))
continue; continue;
if (block == cursor->block() && if (block == cursor->block() &&
(position - block.position() > paren.pos - (paren.type == Parenthesis::Opened ? 1 : 0))) (position - block.position() > paren.pos - (paren.type == Parenthesis::Opened ? 1 : 0)))
......
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