Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tobias Hunger
qt-creator
Commits
9a799da6
Commit
9a799da6
authored
Sep 17, 2009
by
Roberto Raggi
Browse files
Re-enable check for automatically inserted block end.
parent
da4fcd22
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/libs/cplusplus/MatchingText.cpp
View file @
9a799da6
...
...
@@ -40,6 +40,7 @@ static bool maybeOverrideChar(const QChar &ch)
{
if
(
ch
==
QLatin1Char
(
')'
))
return
true
;
else
if
(
ch
==
QLatin1Char
(
']'
))
return
true
;
else
if
(
ch
==
QLatin1Char
(
';'
))
return
true
;
else
if
(
ch
==
QLatin1Char
(
'"'
))
return
true
;
else
if
(
ch
==
QLatin1Char
(
'\''
))
return
true
;
else
return
false
;
...
...
@@ -97,8 +98,6 @@ MatchingText::MatchingText()
QString
MatchingText
::
insertMatchingBrace
(
const
QTextCursor
&
cursor
,
const
QString
&
textToProcess
,
const
QChar
&
la
,
int
*
skippedChars
)
const
{
*
skippedChars
=
0
;
QTextCursor
tc
=
cursor
;
QString
text
=
textToProcess
;
...
...
src/plugins/cppeditor/cppeditor.cpp
View file @
9a799da6
...
...
@@ -1270,16 +1270,25 @@ bool CPPEditor::isElectricCharacter(const QChar &ch) const
}
#if 1
QString
CPPEditor
::
autoComplete
(
QTextCursor
&
cursor
,
const
QString
&
text
)
const
QString
CPPEditor
::
autoComplete
(
QTextCursor
&
cursor
,
const
QString
&
text
ToInsert
)
const
{
bool
checkBlockEnd
=
m_allowSkippingOfBlockEnd
;
m_allowSkippingOfBlockEnd
=
false
;
if
(
!
contextAllowsAutoParentheses
(
cursor
))
return
QString
();
QChar
lookAhead
=
characterAt
(
cursor
.
selectionEnd
());
QString
text
=
textToInsert
;
const
QChar
lookAhead
=
characterAt
(
cursor
.
selectionEnd
());
QString
autoText
;
int
skippedChars
=
0
;
if
(
checkBlockEnd
&&
(
lookAhead
==
QChar
::
ParagraphSeparator
&&
(
!
text
.
isEmpty
()
&&
text
.
at
(
0
)
==
QLatin1Char
(
'}'
))))
{
skippedChars
=
2
;
text
=
text
.
mid
(
1
);
}
MatchingText
matchingText
;
autoText
=
matchingText
.
insertMatchingBrace
(
cursor
,
text
,
lookAhead
,
&
skippedChars
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment