Issue #24972: Inactive selection background now matches active selection
background, as selected by user, on all systems. This also fixes a problem with found items not highlighted on Windows. Initial patch by Mark Roseman. Fix replaces workaround with obscure but proper configuration option.
This commit is contained in:
parent
a8041ae565
commit
62520b2c63
|
@ -349,36 +349,6 @@ 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:
|
||||||
|
@ -800,6 +770,7 @@ class EditorWindow(object):
|
||||||
insertbackground=cursor_color,
|
insertbackground=cursor_color,
|
||||||
selectforeground=select_colors['foreground'],
|
selectforeground=select_colors['foreground'],
|
||||||
selectbackground=select_colors['background'],
|
selectbackground=select_colors['background'],
|
||||||
|
inactiveselectbackground=select_colors['background'],
|
||||||
)
|
)
|
||||||
|
|
||||||
def ResetFont(self):
|
def ResetFont(self):
|
||||||
|
|
Loading…
Reference in New Issue