Alternative string coloring in Scintilla

I am using wxStyledTextCtrl from wxPython, a wrapper around Scintilla .

Is there any way to get an alternative coloring of the lines on it (odd lines in one background color and even lines of a different color)? I am using the python built-in stylist to highlight keywords.

+4
source share
1 answer

The background of lines can be changed, for example, with markers (which are used for things like bookmarks or breakpoints, the current execution point, etc. in the IDE), but there is no built-in mode for changing the background color of each other line.

You can simulate this by setting a special marker with a background color for all odd or even line numbers ( MarkerSetBackground() and MarkerAdd() ). This will probably require many loops, and each editing operation that splits or concatenates, inserts or deletes rows will require the markers to be reset. However, this may be interesting to study, given that there seems to be no other way.

+6
source

Source: https://habr.com/ru/post/1301902/


All Articles