From 4843f44c30bee3cb9ee2d012d2cd5c1358816fde Mon Sep 17 00:00:00 2001 From: Roberto Raggi Date: Fri, 18 Sep 2009 12:27:04 +0200 Subject: [PATCH] Don't allow auto parentheses when the token under cursor is a comment. --- src/plugins/cppeditor/cppeditor.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/cppeditor/cppeditor.cpp b/src/plugins/cppeditor/cppeditor.cpp index 276e5b24eb1..2a681e858c5 100644 --- a/src/plugins/cppeditor/cppeditor.cpp +++ b/src/plugins/cppeditor/cppeditor.cpp @@ -1435,8 +1435,12 @@ bool CPPEditor::contextAllowsAutoParentheses(const QTextCursor &cursor) const CPlusPlus::TokenUnderCursor tokenUnderCursor; const SimpleToken tk = tokenUnderCursor(cursor); - if (tk.isComment()) - return false; + if (tk.isComment()) { + const int pos = cursor.selectionEnd(); + + if (pos < tk.end()) + return false; + } return true; }