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 251167

Summary: Selection lost after search/replace all in selection via CTRL-P
Product: editor Reporter: jlilley
Component: SearchAssignee: Milutin Kristofic <mkristofic>
Status: RESOLVED DUPLICATE    
Severity: normal    
Priority: P3    
Version: 8.0.1   
Hardware: PC   
OS: Windows 7   
Issue Type: DEFECT Exception Reporter:

Description jlilley 2015-03-13 15:14:00 UTC
This may be a duplicate of 175550, but that refers to a different NetBeans major version and very different UI for search/replace.

For example, I have a list of strings:
"abc",
"def",
"ghi",
...

I want to turn this into:
set.add("abc");
set.add("def");
set.add("ghi");

So I select, hit CTRL-H, enter
  Find What: ", 
  Replace With: ");
Hit CTRL-P to replace.
Then I hit CTRL-H again, replace " with set.add("
It replaces the entire file because selection was lost.
Please retain selection after CTRL-P in replacement.

Yes, I know I could do this with a regex.  But not all cases are so simple and this would be broadly applicable.
Comment 1 Milutin Kristofic 2015-09-04 12:23:51 UTC
I was playing with some ideas how to retain selection in replacebar. Problem is if I retain selection it is difficult to get rid of selection.

This usecase :
1, I select text and press ctrl+h
2, I do search and replace in selected text
3, I want to do search and replace in whole document, so I press ctrl+h again to get rid of selection


In your case you should not press ctrl+h, but you should continue working with current replacebar. But I know UI is sometimes confusing, people press ctrl+h by accident and are loosing selection. There are some plans to change UI in Task #219536 and Task #207532 . It is too late to do it to 8.1.

*** This bug has been marked as a duplicate of bug 219536 ***