diff -r b076b62731b7 Lib/idlelib/EditorWindow.py --- a/Lib/idlelib/EditorWindow.py Mon Sep 07 19:59:38 2015 +0300 +++ b/Lib/idlelib/EditorWindow.py Mon Sep 07 11:38:51 2015 -0700 @@ -160,6 +160,15 @@ # to 'wordprocessor' to achieve the same display of tabs as in # older tk versions. text_options['tabstyle'] = 'wordprocessor' + if sys.platform.startswith('win'): + # Tk 8.5 added an option to specify the selection color + # when the window is not active. On X11 and Mac OS X, this + # is an actual color, but on Windows it defaults to empty. + # Without this addition, if another window highlights text + # in the editor (e.g. debugger highlighting current line, + # find dialog highlighting found selection) nothing shows up. + # See issue24972, issue14146, issue22179, issue18590 + text_options['inactiveselectbackground'] = 'gray' self.text = text = MultiCallCreator(Text)(text_frame, **text_options) self.top.focused_widget = self.text @@ -313,36 +322,6 @@ self.askinteger = tkSimpleDialog.askinteger 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("<>", "") - text.event_add("<>", "") - 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("<>", - lambda ev: highlight_fix("out")) - text.bind("<>", - lambda ev: highlight_fix("in")) - - def _filename_to_unicode(self, filename): """Return filename as BMP unicode so diplayable in Tk.""" # Decode bytes to unicode.