Issue with selected text highlighting

13 views
Skip to first unread message

topwizpr...@gmail.com

unread,
Jul 9, 2022, 4:24:09 PMJul 9
to scintilla-interest
I recently updated from 4.20 to 5.2.3 and I am having an issue which doesn't happen with the old version.

I'm using SCI_SETSELBACK to set the text select background color. If the Scintilla control goes out of focus, the color changes to a dark gray color. Then when the control regains focus, it changes back to the color I set it to.

Mitchell

unread,
Jul 9, 2022, 5:57:01 PMJul 9
to scintilla...@googlegroups.com
Hi,
You may need to also use https://scintilla.org/ScintillaDoc.html#SCI_SETELEMENTCOLOUR, perhaps with SC_ELEMENT_SELECTION_INACTIVE_BACK.

Cheers,
Mitchell

Neil Hodgson

unread,
Jul 9, 2022, 6:39:16 PMJul 9
to Scintilla mailing list
topwizpr:

> I'm using SCI_SETSELBACK to set the text select background color. If the Scintilla control goes out of focus, the color changes to a dark gray color. Then when the control regains focus, it changes back to the color I set it to.

To match platform conventions, Scintilla now supports a separate selection background colour for inactive mode. This has a default value which may vary depending on system settings but is currently hard-coded on most platforms.

It may be more compatible for Scintilla to duplicate the SCI_SETSELBACK colour onto SC_ELEMENT_SELECTION_INACTIVE_BACK. However, this may make the interaction between the settings more difficult to understand.

Neil

topwizpr...@gmail.com

unread,
Jul 9, 2022, 7:54:21 PMJul 9
to scintilla-interest
I added SCI_SETELEMENTCOLOUR and now it works. Thanks!

Neil Hodgson

unread,
Jul 9, 2022, 8:18:15 PMJul 9
to Scintilla mailing list
topwizpr:

I added SCI_SETELEMENTCOLOUR and now it works. Thanks!

   To be a bit more specific about why this is occurring, macOS has system settings for colours: textBackgroundColor, selectedTextBackgroundColor, and unemphasizedSelectedTextBackgroundColor. Earlier versions of Scintilla had been criticized for not following any of these settings. The user may use System Preferences to change the colours at any time and Scintilla should respond when this happens.

   Other platforms also have preferred colours for elements although they may be more complex - on Windows, different shades of blue are used in different controls. Support for system settings on other platforms may be extended in the future with macOS used to see if the ‘element’ APIs are a good approach.

   Neil

Reply all
Reply to author
Forward
0 new messages