Issue 1334: IDLE - Fix several highlighting bugs (original) (raw)
This patch fixes the following bugs:
- Configured selection highlighting colors were ignored
- Updating highlighting in the config dialog would cause non-Python files to be colored as if they were Python source
Additionally, adding and removing of ColorDelegators to the Percolator was not being done in an organized fashion, causing multiple colorizers to be present simultaneously in certain cases. This patch ensures that there will always be at most one colorizer present in the Percolator.
This patch also reduces code duplication by grouping colorization code into EditorWindow.ResetColorizer, and having init let ResetColorizer do its thing.
There is one side effect to this patch - applying a new highlighting scheme or renaming a file causes the screen to "blink". This can be avoided without too much work, but IMHO is minor enough to leave as it is.
The first patch contained a bug - a window opened using the "New Window" menu option would not be colorized.
This patch removes the assumption that EditorWindow.ResetColorizer will be called by IOBinding code, by calling ResetColorizer during init anyways. This means that in some cases it will be called multiple times, but this has no noticeable effect since the window is not shown until afterwards. (In the worst case scenario, the colors would "blink" once or twice.)