Find/replace improvements
See original GitHub issueIssue Report Checklist
- Searched the issues page for similar reports
- Reproduced the issue after updating with
conda update spyder(orpip, if not using Anaconda) - Tried basic troubleshooting (if a bug/error)
- Restarted Spyder
- Reset preferences with
spyder --reset - Reinstalled the latest version of Anaconda
- Tried the other applicable steps from the Troubleshooting Guide
- Completed the Problem Description, Steps to Reproduce and Version sections below
Problem Description
When selecting a single line (for later “Replace selection”) and typing the search term, the selection is removed. As seen it may even select text on a different line.

I guess it may have to do with the (positive) feature that the selected text is put into the find text box. However, it also has this disadvantage.
What steps reproduce the problem?
- Mark text on a single line
- Press ctrl+r to open the find-replace widget
- Type a text to find
What is the expected output? What do you see instead?
The selection is kept.
Versions
- Spyder version: 4.0.0.dev0
- Python version: 3.7.3
- Qt version: 5.9.5
- PyQt version: 5.9.2
- Operating System name/version: Windows 10
Dependencies
pygments >=2.0 : 2.4.2 (OK)
qdarkstyle >=2.6.4: 2.7 (OK)
sphinx >=0.6.6 : 2.1.0 (OK)
pyls >=0.27.0 : 0.27.0 (OK)
nbconvert >=4.0 : 5.5.0 (OK)
pandas >=0.13.1 : 0.24.2 (OK)
numpy >=1.7 : 1.16.4 (OK)
sympy >=0.7.3 : 1.4 (OK)
cython >=0.21 : 0.29.10 (OK)
qtconsole >=4.5.0 : 4.5.1 (OK)
IPython >=4.0 : 7.5.0 (OK)
matplotlib >=2.0.0: 3.1.0 (OK)
pylint >=0.25 : 2.3.1 (OK)
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Find Replace improvements - WaveMetrics
I would really like to be able to Replace across multiple procedure windows. I wrote something to try to do this myself, but...
Read more >Search, find, replace improvements - Wappler Community
I'd like to have an improved search, find, replace functionality. For bigger projects the current implementation is not really appropriate: ...
Read more >FindReplace: Find/Replace text in a file in BrailleR - Rdrr.io
Simple wrapper functions to make it easier to replace the text in a file, possibly due to spelling errors, but perhaps to replace...
Read more >Improved Find/Replace in Pages 6 - Apple Community
To Find/Replace a ¶ type \n , for tab use \t , and new line use \l . An improvement but you still...
Read more >Improvement on Find/Replace - Feedback for Affinity Publisher on ...
Already user of Photo and Designer, I just bought Publisher and I'm experimenting with it. One major lack (at least for my work)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Maybe it makes sense to still have a “Replace selection” button. Apart from the original issue here, I think it is much more convenient compared to a check box. I mean, how often do you want to just find something in a selection?
I noticed it while working on #9687 . However, it seems to be using completely different parts of the code (I’ve only looked at what happens after the “Replace selection” button is pressed.)
I may be able to fix it, but not in the near future. I’m also thinking that maybe this is what is supposed to happen, at least parts of it. I mean, copying the selected text (at least in case of a words or so) when pressing ctrl+f or ctrl+r is a nice feature. Being able to interactively search while typing the search term is a nice feature. Not sure if it is possible to distinguish between that and my use case. Maybe by keeping the selection, but still marking the found text if possible? Which may be a quite big effort if the “plain” replace next is based on selection.
Another option would be to have a check box that alternates between find/replace within the whole document and selected text. That would distinguish the use cases, but may also lead to people being annoyed when they forgot to uncheck the box…
I’ll try to see what other editors do.