Skip to content

[BUG] "Find" does not find text if search text contains (invisible) control characters #17124

@HeinzKessler-HaufeGroup

Description

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

If the "Find What" text for "Find" is cpoied&pasted from some other program, e.g. Excel, then it may contain invisible CR and LF characters, most likely at the end of the text. This appears regularly when copying a text cell from Excel.
The CR LF become part of the search text, so that NP++ only finds locations in the file where these charatcres also exist, e.g. at the end of a line.
This is not limited to Excel cells, but any search text from the clipboard containing controls characters.

Steps To Reproduce

  1. Type an few random lines into NP++ and then "Hello, World!"
  2. Go to the top of the file
  3. Type "Hello" into an Excel cell
  4. In Excel, Copy the cell using Ctrl+C
  5. In NP++, press Ctrl+F to open the Find dialog
  6. Leave all setting to their defauls
  7. Paste the text from the clipboard into the "Find What" edit field
  8. Click "Find Next"

Current Behavior

Result: "Hello," will not be found
If "Hello," is entered into the "Find What" field manually, then it will be found

Expected Behavior

Non displayable characters in the "Find What" field will be filtered out by NP++

As a bonus:
If Search Mode=Extended is chosen, when pasting text into "Find What" field, the special characters contained in the search text could be converted into the corresponding control sequences on the fly at step 8. above, so that they become visible to the user. In the above example, the resulting search text would be "Hello\r\n"

Debug Information

Notepad++ v8.8.7   (64-bit)
Build time: Oct 19 2025 - 16:19:15
Scintilla/Lexilla included: 5.5.7/5.4.5
Boost Regex included: 1_85
Path: C:\Program Files\Notepad++\notepad++.exe
Command Line: 
Admin mode: OFF
Local Conf mode: OFF
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: ON
Display Info:
    primary monitor: 2560x1440, scaling 100%
    visible monitors count: 1
    installed Display Class adapters: 
        0000: Description - Red Hat QXL controller
        0000: DriverVersion - 10.0.0.21000
        0001: Description - Microsoft Remote Display Adapter
        0001: DriverVersion - 10.0.22621.5415
        0002: Description - Microsoft Remote Display Adapter
        0002: DriverVersion - 10.0.22621.5415
        0003: Description - Microsoft Remote Display Adapter
        0003: DriverVersion - 10.0.22621.5415
    - warning, search has been limited to maximum number of adapter records: 4
OS Name: Windows 11 Enterprise (64-bit)
OS Version: 23H2
OS Build: 22631.6133
Current ANSI codepage: 1252
Plugins: 
    JsonTools (8.3.1)
    mimeTools (3.1)
    NppConverter (4.7)
    NppExport (0.4)
    XMLTools (3.1.1.13)

Anything else?

I am not sure if this is a feature request or a bug, but it took me quite some while to find the reason for this behavior

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions