Skip to content

gh-71956: Fix IDLE Replace All searching up without wrap around#152737

Merged
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-71956-replace-all-up
Jul 1, 2026
Merged

gh-71956: Fix IDLE Replace All searching up without wrap around#152737
terryjreedy merged 1 commit into
python:mainfrom
serhiy-storchaka:gh-71956-replace-all-up

Conversation

@serhiy-storchaka

@serhiy-storchaka serhiy-storchaka commented Jul 1, 2026

Copy link
Copy Markdown
Member

In the editor's Replace dialog, Replace All with the search direction set to "Up" and "Wrap around" off replaced only the first match above the current position (and, wrongly, all matches below it).

It searched backwards for the first match, then replaced forwards from there to the end of the text. Now, for a backward search without wrap, it replaces top-to-bottom from the start of the text down to the first match at or above the current position — consistently with the "Up" direction. A mark tracks that stop point across the edits.

Minimal reproducer (| is the cursor):

a
a|
a

Search a, replace with b, direction "Up", "Wrap around" off, Replace All.
Before: a / b / b. After: b / b / a.

Tests now cover all four direction/wrap-around combinations.

🤖 Generated with Claude Code

When the search direction is "Up" and "Wrap around" is off, Replace All
replaced only the first match above the current position (and all matches
below it).  It now replaces all matches from the start of the text down to
the current position, consistently with the "Up" direction.
@serhiy-storchaka serhiy-storchaka added needs backport to 3.13 bugs and security fixes needs backport to 3.14 bugs and security fixes needs backport to 3.15 pre-release feature fixes, bugs and security fixes labels Jul 1, 2026
@terryjreedy terryjreedy merged commit ef27e5b into python:main Jul 1, 2026
59 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @serhiy-storchaka for the PR, and @terryjreedy for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Jul 1, 2026

Copy link
Copy Markdown

GH-152799 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 pre-release feature fixes, bugs and security fixes label Jul 1, 2026
@bedevere-app

bedevere-app Bot commented Jul 1, 2026

Copy link
Copy Markdown

GH-152800 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Jul 1, 2026
@bedevere-app

bedevere-app Bot commented Jul 1, 2026

Copy link
Copy Markdown

GH-152801 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.13 bugs and security fixes label Jul 1, 2026
terryjreedy pushed a commit that referenced this pull request Jul 1, 2026
GH-152737) (#152801)

gh-71956: Fix IDLE Replace All searching up without wrap around (GH-152737)

When the search direction is "Up" and "Wrap around" is off, Replace All
replaced only the first match above the current position (and all matches
below it).  It now replaces all matches from the start of the text down to
the current position, consistently with the "Up" direction.
(cherry picked from commit ef27e5b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
terryjreedy pushed a commit that referenced this pull request Jul 1, 2026
GH-152737) (#152800)

gh-71956: Fix IDLE Replace All searching up without wrap around (GH-152737)

When the search direction is "Up" and "Wrap around" is off, Replace All
replaced only the first match above the current position (and all matches
below it).  It now replaces all matches from the start of the text down to
the current position, consistently with the "Up" direction.
(cherry picked from commit ef27e5b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
terryjreedy pushed a commit that referenced this pull request Jul 1, 2026
GH-152737) (#152799)

gh-71956: Fix IDLE Replace All searching up without wrap around (GH-152737)

When the search direction is "Up" and "Wrap around" is off, Replace All
replaced only the first match above the current position (and all matches
below it).  It now replaces all matches from the start of the text down to
the current position, consistently with the "Up" direction.
(cherry picked from commit ef27e5b)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@serhiy-storchaka serhiy-storchaka deleted the gh-71956-replace-all-up branch July 1, 2026 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants