This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: IDLE: Replace selected not working/consistent with find
Type: behavior Stage: patch review
Components: IDLE Versions: Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: ZackerySpytz, marco, markroseman, roger.serwy, terry.reedy
Priority: normal Keywords: patch

Created on 2011-12-12 05:41 by marco, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
issue13586.patch roger.serwy, 2011-12-17 19:25 review
find_keep_open.patch roger.serwy, 2011-12-18 04:39 review
Pull Requests
URL Status Linked Edit
PR 17593 open ZackerySpytz, 2019-12-13 19:28
Messages (9)
msg149276 - (view) Author: Marco Scataglini (marco) Date: 2011-12-12 05:41
Entering the Replace dialog (by ctrl+h or from Edit/Replace... menu) with a selection does not auto-magically have the selected text in the find field.

This is not consistent with the other find functions (ctrl+f: Find...; alt+F3: Find in Files...; ctrl+F3: Find Selection) where the highlighted text automatically entered in the find field.
msg149647 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-12-17 00:01
In 3.2 on Win 7, selected text *is* put in the 'find' field of Replace boxes, just as with Find boxes, just as it should be. So there is something specific either to 2.7 (which is unusual, since the code base in mostly the same, but possible) or to your OS. What are you running Python with?
msg149663 - (view) Author: Marco Scataglini (marco) Date: 2011-12-17 06:41
Win 7 Pro 32bit.
msg149697 - (view) Author: Roger Serwy (roger.serwy) * (Python committer) Date: 2011-12-17 19:25
On Linux using 2.7.1 and 3.2, the Replace dialog does not contain the selected text in the Find field.

The find functionality that copies the selected text was introduced in 868ff0dfabd2 on 2002-11-06. Unfortunately it wasn't added to the Replace Dialog code. The attached patch (against 3.3a0) adds this functionality to Replace Dialog and also removes some non-functional (arguably broken) code.
msg149734 - (view) Author: Marco Scataglini (marco) Date: 2011-12-18 02:19
To check on 3.2 I installed a fresh Python 3.2.1.1 on Win7 x86 32bit and it has the same problem.
So this issues is valid on 2.7.2.1 and 3.2.1.1
I --dry-run Roger patch on both 2.7 and 3.2 with no errors or warnings messages and after patching it fixes the issue on both versions.
msg149735 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-12-18 03:01
I am running 3.2.2 on 64-bit Win7Pro, which should not make a difference. So why did ^H work right for me yesterday and not for Marco today.

Retrying with fresh IDLEs I discovered the following: selections do not initially appear in the find part of a Replace box (^H). But after selecting and opening a Find box (^F) with something selected, the same text appears in Replace boxes regardless of the actual selection, even if there is no selection -- until another Find box is opened.

So I was fooled yesterday because I tried ^F first to see what the 'correct' behavior was and then did ^H with the same selection. And I did the same in both Shell and Edit windows. When testing, order matters ;-).

I discovered something else I am not sure is what we want. Clicking Find in a Replace box leaves the box open so one can Find again. Clicking Find in a Find box closes it. So you need ^F and Find to re-search.
msg149737 - (view) Author: Marco Scataglini (marco) Date: 2011-12-18 04:07
To follow on Terry thought, I think find dialog box should stay open when 'Find' button is pressed, since there is a 'close' button to close it.
That would also be a more accepted behavior similar to all the other editors I know.

And on silly UI design notes:
The 'close' button should be at the bottom instead of the top (and have a capital C)
ctrl+f 'Find' button should say 'Find Next' like most other editors and also since that is what it does.
msg149812 - (view) Author: Marco Scataglini (marco) Date: 2011-12-19 02:18
Thank you Roger
find_keep_open.patch works, but now that brings me to issue13630 that I thought was existing, and now this confirms it.
msg358353 - (view) Author: Zackery Spytz (ZackerySpytz) * (Python triager) Date: 2019-12-13 19:55
I've created a pull request for this issue.  Please take a look.
History
Date User Action Args
2022-04-11 14:57:24adminsetgithub: 57795
2019-12-13 19:55:46ZackerySpytzsetnosy: + ZackerySpytz
messages: + msg358353
2019-12-13 19:28:50ZackerySpytzsetpull_requests: + pull_request17065
2017-06-30 00:27:01terry.reedysetassignee: terry.reedy
versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.4, Python 3.5
2015-09-07 17:30:24markrosemansetnosy: + markroseman
2014-10-03 03:18:32terry.reedysetstage: needs patch -> patch review
versions: + Python 3.5, - Python 3.3
2013-06-15 18:45:54terry.reedysetversions: + Python 3.3, Python 3.4, - Python 3.2
2011-12-19 02:18:30marcosetmessages: + msg149812
2011-12-18 04:39:43roger.serwysetfiles: + find_keep_open.patch
2011-12-18 04:07:12marcosetmessages: + msg149737
2011-12-18 03:01:51terry.reedysetmessages: + msg149735
2011-12-18 02:19:03marcosetmessages: + msg149734
versions: + Python 3.2
2011-12-17 19:25:44roger.serwysetfiles: + issue13586.patch

nosy: + roger.serwy
messages: + msg149697

keywords: + patch
2011-12-17 06:41:39marcosetmessages: + msg149663
2011-12-17 00:02:29terry.reedysettitle: Replace selected not working/consistent with find -> IDLE: Replace selected not working/consistent with find
2011-12-17 00:01:57terry.reedysetnosy: + terry.reedy

messages: + msg149647
stage: needs patch
2011-12-12 05:41:52marcocreate