User forums > Using Code::Blocks

Code completion occurring inside comments

<< < (3/3)

Jenna:

--- 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!

--- End quote ---
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.

--- End quote ---

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.

Jenna:

--- 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!

--- End quote ---
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.

--- End quote ---

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.



--- End quote ---
Any comments ?

MortenMacFly:

--- Quote from: jens on March 01, 2013, 10:45:42 pm ---Any comments ?

--- End quote ---
No, seems to work here - at lest I see not negative side-effects.

Navigation

[0] Message Index

[*] Previous page

Go to full version