[Python-checkins] cpython (3.4): Issue #24972: Inactive selection background now matches active selection

Terry Reedy tjreedy at udel.edu
Mon Sep 28 05:10:39 CEST 2015


On 9/27/2015 10:51 PM, terry.reedy wrote:
> https://hg.python.org/cpython/rev/70c01dd35100
> changeset:   98343:70c01dd35100
> branch:      3.4
> parent:      98340:1ae0e02b541d
> user:        Terry Jan Reedy <tjreedy at udel.edu>
> date:        Sun Sep 27 22:46:17 2015 -0400

I committed this before noticing that Alexander Belopolsky had left a 
hanging 3.4 commit (and one for 3.5).  When I tried to merge forward, 
two of his files had merge conflicts, so I could not continue (or did 
not know how).  I backed this out and pushed, in order to get the 2.7 
commit pushed, but I don't know if this was exactly the right thing to do.

Without merge conflicts in other files, this patch will merge to 3.5 and 
default cleanly, as EditorWindow.py is identical in all 3 versions.

> summary:
>    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.
>
> files:
>    Lib/idlelib/EditorWindow.py |  31 +------------------------
>    1 files changed, 1 insertions(+), 30 deletions(-)
>
>
> diff --git a/Lib/idlelib/EditorWindow.py b/Lib/idlelib/EditorWindow.py
> --- a/Lib/idlelib/EditorWindow.py
> +++ b/Lib/idlelib/EditorWindow.py
> @@ -317,36 +317,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("<<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):
>           """Return filename as BMP unicode so diplayable in Tk."""
>           # Decode bytes to unicode.
> @@ -785,6 +755,7 @@
>               insertbackground=cursor_color,
>               selectforeground=select_colors['foreground'],
>               selectbackground=select_colors['background'],
> +            inactiveselectbackground=select_colors['background'],
>               )
>
>       IDENTCHARS = string.ascii_letters + string.digits + "_"
>
>
>
> _______________________________________________
> Python-checkins mailing list
> Python-checkins at python.org
> https://mail.python.org/mailman/listinfo/python-checkins
>



More information about the Python-checkins mailing list