enthought / enthought/traitsui

CodeEditor highlighting broken with wxPython

Open
#1,990 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

## 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:

https://user-images.githubusercontent.com/5692808/223987696-8838cddf-9d22-42b8-b39c-6cf440907681.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:

https://github.com/enthought/traitsui/blob/ce8b285a6bedefc551b61bf3d39a74f7dd04d662/traitsui/wx/code_editor.py#L354-L356

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.