Commit 66f2e323 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Fixed the context in which automatic parentheses are placed

Done with mae and Roberto Raggi.
parent d11af451
...@@ -1272,7 +1272,10 @@ bool CPPEditor::contextAllowsAutoParentheses(const QTextCursor &cursor) const ...@@ -1272,7 +1272,10 @@ bool CPPEditor::contextAllowsAutoParentheses(const QTextCursor &cursor) const
{ {
CPlusPlus::TokenUnderCursor tokenUnderCursor; CPlusPlus::TokenUnderCursor tokenUnderCursor;
const SimpleToken tk = tokenUnderCursor(cursor); 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) void CPPEditor::indentInsertedText(const QTextCursor &tc)
......
Supports Markdown
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