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

Scener Spanish spscener84 at gmail.com
Tue May 14 14:55:03 BST 2019


>
>
> No this third colour is something different. It is used in a specific
> circumstance but is undocumented and unchangeable.
>
> 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.)


I've looked at the Scintilla source code a bit and it seems you're right,
that 3rd
undocumented color is a read-only color initialized in ViewStyle.cxx at:

https://github.com/brupelo/scintilla/blob/master/src/ViewStyle.cxx#L84
https://github.com/brupelo/scintilla/blob/master/src/ViewStyle.cxx#L211

it's initialized in both ViewStyle default and copy constructors.

And then used through this function
https://github.com/brupelo/scintilla/blob/master/src/EditView.cxx#L831-L835,

we can see that color will be used when main=True and
primarySelection=False, if we inspect a little bit more that EditView.cxx
file
we'll see this function is called in few places such as:

return SelectionBackground(vsDraw, true, model.primarySelection);
return SelectionBackground(vsDraw, false, model.primarySelection);
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw, r ==
model.sel.Main(), model.primarySelection));
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw,
eolInSelection == 1, model.primarySelection));
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw,
eolInSelection == 1, model.primarySelection), alpha);
surface->FillRectangle(rcSegment, SelectionBackground(vsDraw,
eolInSelection == 1, model.primarySelection));
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw,
eolInSelection == 1, model.primarySelection), alpha);
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw,
eolInSelection == 1, model.primarySelection), alpha);
const ColourDesired background = SelectionBackground(vsDraw, r ==
model.sel.Main(), model.primarySelection);
SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw, r ==
model.sel.Main(), model.primarySelection), alpha);
surface->FillRectangle(rcArea, SelectionBackground(vsDraw, eolInSelection
== 1, model.primarySelection));
SimpleAlphaRectangle(surface, rcArea, SelectionBackground(vsDraw,
eolInSelection == 1, model.primarySelection), alpha);


if we analize the above set of calls we'll see there are some unique cases
from the whole set:

SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection);
SelectionBackground(vsDraw, false, model.primarySelection);
SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection);
SelectionBackground(vsDraw, true, model.primarySelection);


if we've get rid of the 2nd one, the only cases where that color could will
be used is on these calls:

SelectionBackground(vsDraw, eolInSelection == 1, model.primarySelection);
SelectionBackground(vsDraw, r == model.sel.Main(), model.primarySelection);
SelectionBackground(vsDraw, true, model.primarySelection);


Of course this doesn't explain the "human" meaning of that color but at
least gives more background about it :/

Btw, it'd be great eventually to be able to build QScintilla myself so i
could help to debug these type of issues... unfortunately when I
attempted to do so I've failed miserably :( . I'm on
win7+latest_sip+latest_qscintilla and I've got vs2008/2010/2012/2015/2017
and yeah,
before you post the link I've read the provided docs at qscintilla :) ,
could you advice?

Thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/qscintilla/attachments/20190514/aba62bcb/attachment.html>


More information about the QScintilla mailing list