Using C::B 12.11, I am getting code completion popping up inside C++ comments. Am I alone in this (I did search before posting), and is there an easy way of stopping it? Screenshot here http://imgur.com/bL9VtGb .
I'd rather say this is a feature (at least for me) :)
Well, it's not for me! I find it intensely irritating having CC pop up when I'm writing non-program text. At the very least, it should be optional.
I think it is a cc bug, I can't reproduce this issue.
The guard:
codecompletion.cpp: 2874
if ( control->IsString(style)
|| control->IsComment(style)
|| control->IsCharacter(style)
|| control->IsPreprocessor(style) )
{
return;
}
should already prevent this. Can you post a test case this behavior is occurring on?
Further investigation indicates that the behaviour is actually quite bizarre. If I create a new header file in a console project and start adding C++-style comments (but nothing else - no actual code), then the first word that can cause CC to fire will do so. So, if I enter;
// this
then the code completion list pops up for "this", and for any other completable words as type them. If I enter a newline, then it seems the behaviour goes back to normal, and no CC takes place in the comment. So it looks like the code for IsComment() may be a bit buggy.
Quote from: Neil Butterworth on February 20, 2013, 03:50:02 PM
...So it looks like the code for IsComment() may be a bit buggy.
I agree with you, you can report to scintilla :).
IsComment(style) is part of cbStyledTextCtrl not scintilla!
Quote from: danselmi on February 20, 2013, 04:12:13 PM
IsComment(style) is part of cbStyledTextCtrl not scintilla!
The problem is the control->GetStyleAt() function, that always returns 0 as style for the last position of a document.
And that's a Scintilla issue.
Is this a new Scintilla issue? Because I'm pretty positive it didn't happen prior to C::B 12.11.
Edit: Oh, yes it does (just tested it) - I wonder why I've never noticed it before?
Quote from: jens on February 20, 2013, 06:19:39 PM
Quote from: danselmi on February 20, 2013, 04:12:13 PM
IsComment(style) is part of cbStyledTextCtrl not scintilla!
The problem is the control->GetStyleAt() function, that always returns 0 as style for the last position of a document.
And that's a Scintilla issue.
Maybe not an issue, because the last postion is not styled at all, so retuzrning a zero.style might be considered the correct way to handle it.
I attach a patch with a quick (and more or less ugly) fix for this.
If the caret is on last position of a document (with length > 0) we use the style for the last character.
Quote from: jens on February 26, 2013, 10:51:50 AM
Quote from: jens on February 20, 2013, 06:19:39 PM
Quote from: danselmi on February 20, 2013, 04:12:13 PM
IsComment(style) is part of cbStyledTextCtrl not scintilla!
The problem is the control->GetStyleAt() function, that always returns 0 as style for the last position of a document.
And that's a Scintilla issue.
Maybe not an issue, because the last postion is not styled at all, so retuzrning a zero.style might be considered the correct way to handle it.
I attach a patch with a quick (and more or less ugly) fix for this.
If the caret is on last position of a document (with length > 0) we use the style for the last character.
Any comments ?
Quote from: jens on March 01, 2013, 10:45:42 PM
Any comments ?
No, seems to work here - at lest I see not negative side-effects.