Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ReplaceAll/MarkAll/Count can execute opposite of user InSelection intention #14897

Open
alankilborn opened this issue Mar 23, 2024 · 0 comments

Comments

@alankilborn
Copy link
Contributor

alankilborn commented Mar 23, 2024

Issue Description

Logic executes to auto-set or auto-clear the In selection checkbox when the Replace window becomes the active window, depending upon the amount of selected text in the recently-active editor window. Because pressing Replace All on an inactive Replace window will activate the window, and then run the Replace All functionality, it is possible for the In selection checkbox to appear in one state to the user (at the moment of button press), but yet be in the opposite state when the Replace All is actually conducted.

Steps to Reproduce the Issue

  1. In Preferences > Searching set Minimum Size for Auto-Checking "In selection" to 6.
  2. Create a new Notepad++ tab with this text:
abcdefg
abcdefg
abcdefg
  1. Select a through g on the line 1 and press Ctrl+h to invoke the Replace window.
  2. Specify Find what of c.
  3. Specify Replace with of Z.
  4. Note that In selection is checkmarked (automatically, because 7 characters were selected when replace was invoked).
  5. Checkmark Wrap around and uncheckmark everything else (except In selection).
  6. Press the Replace All button.
  7. Observe (correct replacement):
abZdefg
abcdefg
abcdefg
  1. Leave the Replace window open and move input focus back to the editor window.
  2. Select b through d on line 2.
  3. Without otherwise activating the Replace window, and noting that In selection is still checkmarked, press the Replace All button.

Actual behavior:

abZdefg
abZdefg
abZdefg

Line 3 was changed.

Expected behavior:

abZdefg
abZdefg
abcdefg

Line 3 should not have been changed and should still have a c in it.

Notes

This can also "go the other way", where the user sees an uncheckmarked In selection at the moment of Replace All press, and then observes that only the selected text affected by the replacement.

This is a restatement of #14624 which sort of "lost its way".

Workaround: Activate Replace without clicking on an activatable control (e.g., click the Replace window's title bar, then alter In selection if needed, then finally press Replace All.

EDIT: It can also happen with the Mark All button as well, on the Mark window (edited title of issue to reflect this).

EDIT: It can also happen with the Count button as well, on the Find window (edited title of issue to reflect this).

EDIT: This seems to be a problem introduced by "solving" #14108.

Debug Information

Notepad++ v8.6.4 (64-bit)
Build time : Feb 20 2024 - 00:12:59
Path : C:\NotepadPlusPlus\Misc_NoBackup\Releases\npp.8.6.4\npp.8.6.4.portable.x64\notepad++.exe
Command Line : -multiInst
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
OS Name : Windows 11 Pro (64-bit)
OS Version : 23H2
OS Build : 22631.3155
Current ANSI codepage : 1252
Plugins :
mimeTools (3.1)
NppConverter (4.6)
NppExport (0.4)

@alankilborn alankilborn changed the title ReplaceAll can execute opposite of user InSelection intention ReplaceAll/MarkAll can execute opposite of user InSelection intention Mar 23, 2024
@alankilborn alankilborn changed the title ReplaceAll/MarkAll can execute opposite of user InSelection intention ReplaceAll/MarkAll/Count can execute opposite of user InSelection intention Mar 23, 2024
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

No branches or pull requests

1 participant