Fixed the context in which automatic parentheses are placed

Done with mae and Roberto Raggi.
This commit is contained in:
Thorbjørn Lindeijer
2009-09-16 16:27:41 +02:00
parent d11af4511b
commit 66f2e3235e

View File

@@ -1272,7 +1272,10 @@ bool CPPEditor::contextAllowsAutoParentheses(const QTextCursor &cursor) const
{
CPlusPlus::TokenUnderCursor tokenUnderCursor;
const SimpleToken tk = tokenUnderCursor(cursor);
return !(tk.isComment() || tk.isLiteral());
if (tk.isComment() || tk.isLiteral())
if (tk.end() > cursor.position() - cursor.block().position())
return false;
return true;
}
void CPPEditor::indentInsertedText(const QTextCursor &tc)