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.

Title: idle editor: replace all in selection
Type: enhancement Stage: test needed
Components: IDLE Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: terry.reedy Nosy List: bagratte, markroseman, rhettinger, terry.reedy
Priority: normal Keywords:

Created on 2014-09-22 10:28 by bagratte, last changed 2022-04-11 14:58 by admin.

Messages (5)
msg227260 - (view) Author: bagrat lazaryan (bagratte) Date: 2014-09-22 10:28
say, for renaming a variable in a block of code, or in a function, or renaming a method name in a class, etc. nothing fancy here, a button in the replace dialog will do.
i think the proposed functionality is needed much more often than the currently implemented replacing within the whole file.
msg227639 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-09-26 17:29
This is an interesting idea, but not a high priority.  One can selectively replace now with [Find], [Replace], and [Replace+Find] buttons. I have been thinking about improving the Search and Replace dialogs, so I will not immediately reject this.  Some additional comments follow.

A changed method name has to be replaced in all use sites, not just in the class definition.  Some editors will make replacements across multiple files.

Renaming a local variable in a def statement, or the loop variable in a for statement (using the [X] whole word option) would be good uses.

[Replace All] could be defined to only apply to a selection when there is a selection.

The new feature would be more useful if there were a 'select suite' or 'select statement' command that would, for instance, select an entire def statement if the cursor were on the first line, with the 'def' keyword.

Currently, on Windows, the 'found' highlight does not work when there is a selection.  That might be a simple fix.  There is already an issue for fixing Search dialogs.

Do you know of any other editors with this feature?
msg227797 - (view) Author: bagrat lazaryan (bagratte) Date: 2014-09-29 14:16
replacing across multiple files is something i personally considered too fancy for idle, but that's a great feature. the same goes for smart selections like selecting multiline statements. if they don't contradict idle's simplicity ideology they are great canditates to be implemented.

as to the editors currently implementing replace-in-selection, notepad++ is one. it actually does exactly what terry suggested, activating an "in selection" checkbox only if something is selected. (visual studio, and python tools for visual studio in particular, have some replacement and refactoring abilities too.)

now, guys, i'm very sorry that i have to return to my already mentioned off-topic issue: i'm not getting emails from bugtracker. not even in spam. i was about to file a bug on the metatracker but it seems i can't even register on it because i am not receiving that confirmation email to activate my account! i don't know if is related to my problem. it seems it might be. what am i to do?
msg227815 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-09-29 18:15
About your email problem: post to core-mentorship list and if you cannot do that, write to Ezio Melotti and/or R. David Murray directly, as they are tracker maintainers.
msg250148 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2015-09-08 03:20
-0 on doing this.  The current Find/Replace works pretty well even for replacements within a block (though it takes a few clicks to apply them one at a time).   In general, IDLE aspires to be minimalist and favor rapid learnability over having more features and options
Date User Action Args
2022-04-11 14:58:08adminsetgithub: 66650
2020-06-07 22:34:44terry.reedysetversions: + Python 3.10, - Python 3.6, Python 3.7
2017-06-23 05:00:50terry.reedysetassignee: terry.reedy
stage: needs patch -> test needed
versions: + Python 3.6, Python 3.7, - Python 2.7, Python 3.4, Python 3.5
2015-09-08 03:20:52rhettingersetnosy: + rhettinger
messages: + msg250148
2015-09-07 17:30:11markrosemansetnosy: + markroseman
2014-09-29 18:15:27terry.reedysetmessages: + msg227815
stage: needs patch
2014-09-29 14:16:52bagrattesetmessages: + msg227797
2014-09-26 17:29:48terry.reedysetnosy: + terry.reedy
messages: + msg227639
2014-09-22 10:28:55bagrattecreate