[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-18 Thread Tal Einat


Tal Einat  added the comment:

I closed the PR but IMO this issue should remain open.

I am changing the title, though, since this is not actually Windows-specific.

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-18 Thread E. Paine


Change by E. Paine :


--
stage: patch review -> resolved
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-18 Thread Tal Einat


Tal Einat  added the comment:

I can reproduce this behavior on macOS as well, so this doesn't seem to be 
Windows-specific.

This does not happen with other apps in general, so it is not normal behavior 
for apps.

Testing with a minimal tkinter app (see code below) gives similar behavior, so 
this appears to be an issue with tkinter and/or tcl/tk.


import tkinter
text = tkinter.Text()
text.pack()
tkinter.mainloop()

--
nosy: +taleinat

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

eryksun, Piping to clip.exe is not working well.  On the patch, I asked if you 
know what Windows system call it uses, but I cannot request your review there.

--
nosy: +eryksun

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-17 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Now that I think about it, I have run into enough problems with ^V not pasting 
something copied with ^C that I always leave source windows open until 
successful.  I had not noticed that there is only a problem between windows 
(but this may be true) or after closing IDLE or that it only occurs when 
copying *from* IDLE.  In fact, the last might not be true if other apps have 
the same bug.  (I will start paying more attention after this is fixed.)

--
type: enhancement -> behavior

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-17 Thread E. Paine

E. Paine  added the comment:

Test example:

1) Open IDLE (shell or editor)
2) Copy some text in the IDLE window
3) Close the IDLE window (instance should end)
4) Paste into application of choice
Without the patch, the clipboard is cleared when the instance ends so nothing 
is pasted. With the patch, the content remains in the clipboard as expected.

Note: This is not a problem if clipboard history is turned on or the content is 
pasted before closure, however the order of events above is fairly common for 
me.


Encoding:

In the latest commit to the pull, I have changed the encoding from UTF-8 to 
UTF-16 and my reasoning is as follows:

1) Most importantly, using UTF-8, characters with a unicode value >=2^8 are 
incorrectly copied as multiple characters. UTF-8 does support these characters 
but uses a different number of bytes per character (which is presumably what is 
causing these issues - for example, "AĀ" is encoded as "\x41\xc4\x80", which 
pastes as "A─Ç") UTF-16, however, correctly works for all characters supported 
by Tcl (see next point).

2) "Strings in Tcl are encoded using 16-bit Unicode characters" 
(https://www.tcl.tk/man/tcl8.2.3/TclCmd/encoding.htm). Therefore, the encoding 
we choose should have at least 16 bits allocated per character (meaning either 
UTF-16 or UTF-32).

3) Windows' "Unicode-enabled functions [...] use UTF-16 (wide character) 
encoding, which is [...] used for native Unicode encoding on Windows operating 
systems" (https://docs.microsoft.com/en-us/windows/win32/intl/unicode). For me, 
this was what decided the new encoding (between the two given in the previous 
point).

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue40452] IDLE: preserve clipboard on closure on Windows

2020-05-15 Thread Terry J. Reedy


Terry J. Reedy  added the comment:

Please write out a manual test example (steps 1, 2, ..., N) that fails now and 
passes with the patch.

--
title: IDLE preserve clipboard on closure (Windows) -> IDLE: preserve clipboard 
on closure  on Windows
versions: +Python 3.7, Python 3.8

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com