[QScintilla] Main selection color is not changed properly in some cases

Phil Thompson phil at riverbankcomputing.com
Tue May 14 13:56:28 BST 2019


On 14/05/2019 13:01, Scener Spanish wrote:
>> The colour being used is a hardcoded value that cannot be changed. 
>> This
>> colour is used when the caret is not in the selection and the 
>> selection
>> is not the primary selection. As far as I can see, this reflects what 
>> is
>> happening. I don't know what the purpose of this colour is.
>> 
> 
> Me neither, although if we stick to the docs we can see there are 2 
> colors
> when it comes to selections, the main
> selection and additional ones... maybe that hardcoded value is the 
> default
> value of additional selections
> changed somewhere else? (Dunno, just speculating)

No this third colour is something different. It is used in a specific 
circumstance but is undocumented and unchangeable.

>> It seems to me that the behaviour you are expecting is that the CTRL
>> modifier should be ignored when making the first selection. Changing
>> line 4627 of Editor.cpp from...
>> 
>>      if (ctrl && multipleSelection) {
>> 
>> ...to...
>> 
>>      if (ctrl && multipleSelection && !SelectionEmpty()) {
>> 
> 
> Awesome, nice you've already found a possible workaround/hack for the 
> first
> test but I wonder, why is it necessary to have
> these workaround at all? Shouldn't QScintilla be a simple layer/bypass 
> of
> Scintilla? I mean... when you use Scintilla/Scite the
> issue of the first test won't appear

As well as the "high level" API QScintilla also implements the low level 
toolkit-specific layer. It's quite possible that this low level layer 
has a bug, but I'm not convinced.

>> ...achieves this. However this changes doesn't affect the second test.
>> 
> 
> :( , fixing the 2nd test would be awesome as one of the more common 
> tasks
> when using multiselection is what in SublimeText is known
> as "Quick Find All" which is a great tool when it comes to refactor 
> code.
> 
> Anyway, thanks for looking into this!

I would ask the Scintilla developers what the purpose of the colour 
(implemented as ViewStyle::selBackground2) is. (Assuming it is still in 
the current code.)

Phil


More information about the QScintilla mailing list