This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 271234 - Find and Replace within Selection is inconsistent
Summary: Find and Replace within Selection is inconsistent
Status: NEW
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 8.2
Hardware: PC Windows 8.1 x64
: P2 normal with 1 vote (vote)
Assignee: Milutin Kristofic
Depends on:
Reported: 2017-08-04 18:25 UTC by CaptainStarbuck
Modified: 2017-08-04 18:25 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Note You need to log in before you can comment on or make changes to this bug.
Description CaptainStarbuck 2017-08-04 18:25:21 UTC
When using Ctrl+H to replace within the current selection, there is some condition that turns off the "active selection" flag, resulting in a global change. This has been reported in tickets since 2010 in PC, Linux, and Mac. I recently posted a test case in bug 207532 to verify that "find replace within selection" actually does work. Moving to another tab and doing a similar operation it insisted on doing global changes.

I will try to find/post a reproducible case given other obligations and time constraints. 
Possible triggers:
- Issue might be reset by closing the current tab and re-opening.
- Might be related to floating a tab.
- Currently only tested with PHP. Will try to test with Java and other file types.
- Might be related to doing a non-regex then changing to regex, or the second regex on some other condition, or selection after entry of find/replace text then clicking Replace All, or maybe related to whether selection starts at column 1 or ends at column 1 or beyond some other column...

People have been mentioning this issue for years, as an aside in find-related tickets, or as the topic of bug reports, and it doesn't look like there has been a dedicated effort to nail it - probably because it's inconsistent. I hope this ticket will drive toward focused testing and finally a fix.

 Highlight some text, ctrl+H, enter the search and replace terms as Regex, and then click Replace All to replace only within the current selection.

 SOMETIMES - All instances of the search pattern are replaced within the entire file. (Possibly within all open files? Need to verify.)

 Only replace within the selected area.

Product Version: NetBeans IDE 8.2 (Build 201609300101)
Updates: NetBeans IDE is updated to version NetBeans 8.2 Patch 2
Java: 1.8.0_141; Java HotSpot(TM) 64-Bit Server VM 25.141-b15
Runtime: Java(TM) SE Runtime Environment 1.8.0_141-b15
System: Windows 8.1 version 6.3 running on amd64; Cp1252; en_US (nb)

Reports in bug 207532 request an enhancement to add find/replace in selection feature but this is invalid. The feature exists. But several people report the issue documented here, which is why I'm creating a separate ticket for a bug.

Exact same report on Mac in bug 268525

Slight relation to bug 175550

bug 118612

Bug 124504 closed in bulk cleanup

bug 217312