notepad-plus-plus / notepad-plus-plus/notepad-plus-plus

[BUG] Replace "in selection" behavior

Open
#17,497 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
29.4k
Forks
5.4k
PR merge metrics
No merged PRs in 30d

Description

Is there an existing issue for this?
  • I have searched the existing issues
Is the issue reproducible in Notepad++ without plugin?
  • I have tried Notepad++ without plugin
Is the issue reproducible in portable version of Notepad++?
  • I have tried portable version of Notepad++
Does the issue affect SciTE?
  • I have tried SciTE
Description of the Issue

Known issue and weird behavior unseen in other text editors.

Steps To Reproduce
  1. have a text
  2. select the whole text with Ctrl+a
  3. open the replace dialog with Ctrl+h
  4. the "In selection" is automatically checked
  5. fill in "Find what" and "Replace with"
  6. change your mind and select just a few lines instead of the whole text
  7. click "Replace all"
Current Behavior
  1. the "In selection" gets automatically unchecked and a warning dialog box appears

Btw :

  1. click inside the replace dialog to set in focus (without clicking the "Replace all" button)
  2. the "In selection" gets automatically unchecked (without the warning dialog box appearing)
Expected Behavior

If some lines are selected, even if they changed from when the replace dialog was opened, just DO NOT uncheck "In selection".

Uncheck it ONLY if there is no selection, because that wouldn't make sense.

But better :

If "In selection" is checked while there is no selection, open the warning dialog box, and ONLY in that case.

NEVER EVER change the state of "In selection" since I often change the scope of replacing text across my code and select different set of lines, each time I return into the replace dialog, I get the "In selection" state screwed, with a warning dialog box appearing or not.

Debug Information
Notepad++ v8.9.1   (32-bit)
Build time: Jan 18 2026 - 22:44:01
Scintilla/Lexilla included: 5.5.8/5.4.6
Boost Regex included: 1_90
pugixml included: 1.15
nlohmann JSON included: 3.12.0
Path: F:\_TST\npp.8.9.1.portable(1)\notepad++.exe
Command Line: 
Admin mode: OFF
Local Conf mode: ON
Cloud Config: OFF
Periodic Backup: ON
Placeholders: OFF
Scintilla Rendering Mode: SC_TECHNOLOGY_DIRECTWRITE (1)
Multi-instance Mode: monoInst
asNotepad: OFF
File Status Auto-Detection: cdEnabledNew (for current file/tab only)
Dark Mode: OFF
Display Info:
    primary monitor: 1920x1080, scaling 100%
    visible monitors count: 2
    installed Display Class adapters: 
        0000: Description - AMD Radeon(TM) Vega 8 Graphics
        0000: DriverVersion - 26.20.12036.1
OS Name: Windows 10 Enterprise (64-bit)
OS Version: 22H2
OS Build: 19045.6456
Current ANSI codepage: 1252
Plugins: 
    mimeTools (3.1)
    NppConverter (4.7)
    NppExport (0.4)
Anything else?

It's a YEARS LONG running gag, just FIX it by NOT playing "smart" and unchecking "In selection" when YOU feel the need to.

Have a predictable behavior and let the user do it on HIS own, at HIS discretion.

https://github.com/notepad-plus-plus/notepad-plus-plus/issues/9611
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/11202
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/14650
https://github.com/notepad-plus-plus/notepad-plus-plus/issues/16069
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the behavior in the Replace dialog opened with Ctrl+h, following the selection changes and Replace all steps described in the issue. Trace how the dialog handles the "In selection" state when focus changes or the selection becomes empty; done means it remains checked for a non-empty selection and warns only when no selection exists.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.