gh-69365: Show search pattern errors in the IDLE search dialogs - #157598
Conversation
Show the error in red below the entry and move the cursor to the offending character in the pattern, instead of a message box. Find Again without a dialog still uses the message box. Check the pattern as typed, so that the position is right. This also fixes the "Whole word" option with a regular expression: the pattern is now grouped, so that "a|b" is anchored on both sides, and a pattern ending with a backslash is an error instead of matching "\b". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Unrelated test failure: (rerunning) EDIT: PASS |
|
Looks good to me. I thought about reporting an error as soon as detected, but doing that while fixing an error would be annoying. Was omitting backports an accident? I will create them but not merge immediately. |
|
Yes, it was omitted by accident. Thank you for your review. |
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14, 3.15. |
|
GH-157667 is a backport of this pull request to the 3.15 branch. |
|
GH-157668 is a backport of this pull request to the 3.14 branch. |
|
GH-157669 is a backport of this pull request to the 3.13 branch. |
The Find, Replace and Find in Files dialogs now show a regular expression error in red below the entry, as the Open Module dialog does, and move the cursor to the offending character, instead of a message box that has to be dismissed first. The pattern is checked as typed, to detect ffirst error position, and a message is shown when a Find/Replace button is hit. The message is cleared when the pattern is edited. Find Again without a dialog still uses the message box.
When "Whole word" is checked, the pattern is grouped so that it is anchored on both sides. Global flags like
(?i)cannot be used with "Whole word. A pattern ending with a backslash is an error instead of matching\b. Such error are reported.🤖 Generated with Claude Code