Commit 02c0ed06 authored by Roger Serwy's avatar Roger Serwy

#14146: Highlight source line while debugging on Windows.

parent d7cb5067
...@@ -346,6 +346,36 @@ class EditorWindow(object): ...@@ -346,6 +346,36 @@ class EditorWindow(object):
self.askinteger = tkSimpleDialog.askinteger self.askinteger = tkSimpleDialog.askinteger
self.showerror = tkMessageBox.showerror self.showerror = tkMessageBox.showerror
self._highlight_workaround() # Fix selection tags on Windows
def _highlight_workaround(self):
# On Windows, Tk removes painting of the selection
# tags which is different behavior than on Linux and Mac.
# See issue14146 for more information.
if not sys.platform.startswith('win'):
return
text = self.text
text.event_add("<<Highlight-FocusOut>>", "<FocusOut>")
text.event_add("<<Highlight-FocusIn>>", "<FocusIn>")
def highlight_fix(focus):
sel_range = text.tag_ranges("sel")
if sel_range:
if focus == 'out':
HILITE_CONFIG = idleConf.GetHighlight(
idleConf.CurrentTheme(), 'hilite')
text.tag_config("sel_fix", HILITE_CONFIG)
text.tag_raise("sel_fix")
text.tag_add("sel_fix", *sel_range)
elif focus == 'in':
text.tag_remove("sel_fix", "1.0", "end")
text.bind("<<Highlight-FocusOut>>",
lambda ev: highlight_fix("out"))
text.bind("<<Highlight-FocusIn>>",
lambda ev: highlight_fix("in"))
def _filename_to_unicode(self, filename): def _filename_to_unicode(self, filename):
"""convert filename to unicode in order to display it in Tk""" """convert filename to unicode in order to display it in Tk"""
if isinstance(filename, unicode) or not filename: if isinstance(filename, unicode) or not filename:
......
...@@ -21,6 +21,12 @@ Library ...@@ -21,6 +21,12 @@ Library
- Fix typos in the multiprocessing module. - Fix typos in the multiprocessing module.
IDLE
----
- Issue #14146: Highlight source line while debugging on Windows.
Tests Tests
----- -----
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment