enthought/traitsui

CodeEditor highlighting broken with wxPython

Opened this issue · 0 comments

Description

Using the wxPython backend, the CodeEditor highlighting does not work as expected. In particular, only some of the lines are being highlighted. See the following video:

Video0.mp4

The video is generated from the following code: https://github.com/greschd/traitsui_code_editor_syntax_highlighting_issue/blob/main/code_editor_test.py

In particular, only selected lines appear to be highlighted, depending on which line was last edited.

Additional context

I can get the syntax highlighting to appear correctly by removing the following lines:

else:
self.control.StartStyling(position)
self.control.SetStyling(style_length, stc.STC_STYLE_DEFAULT)

However, I'm not familiar enough with wx.stc highlighting to know if this might be the correct solution, or what else this might break. I have not tested this in combination with the options selected_line, dim_lines, etc..

Environment

Tested on the following environments, with the same behavior everywhere:

  • OS: Windows 11
    • Python 3.9
      • wxPython 4.1.1
      • wxPython 4.2.0
    • Python 3.10
      • wxPython 4.2.0
  • OS: Ubuntu 20.04 on WSL2
    • Python 3.8
      • wxPython 4.2.0