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 203269 - Create Find after replace checkbox - Replacebar does not change the visual selection after "replace"
Summary: Create Find after replace checkbox - Replacebar does not change the visual se...
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 7.1
Hardware: PC All
: P3 normal (vote)
Assignee: Milutin Kristofic
URL:
Keywords:
: 152128 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-10-06 23:24 UTC by tbrunhoff
Modified: 2012-01-16 15:59 UTC (History)
2 users (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tbrunhoff 2011-10-06 23:24:26 UTC
- insert three identical tokens in an edit window, like
    xxxx
    xxxx
    xxxx
- type ctrl-h (replace bar pops up) and type 'xxxx' in the "Find What" box.
- type 'yyyy' in the "Replace with" box
- click "Next".  This will probably wrap around and turn the first xxxx blue.
- click "Replace". The selection changes to yyyy and becomes deselected.

At this point the second xxxx should be blue, but it is yellow. It is actually selected and clicking "replace" again does the replacement. However, if I click on the "next" button, the second xxxx now turns blue.

Product Version: NetBeans IDE Dev (Build 201110050601)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Linux version 2.6.35.13-92.fc14.x86_64 running on i386; UTF-8; en_US (nb)
User directory: /home/toddb/.netbeans/dev
Cache directory: /home/toddb/.netbeans/dev/var/cache
Comment 1 tbrunhoff 2011-10-06 23:32:37 UTC
If any other occurrences of the selected text are off the page when the replacement begins, they will not show any highlighting: yellow or blue.
Comment 2 Jiri Prox 2011-10-07 08:32:34 UTC
reproducible
Comment 3 Milutin Kristofic 2011-10-24 09:46:07 UTC
*** Bug 204091 has been marked as a duplicate of this bug. ***
Comment 4 Milutin Kristofic 2011-10-26 14:46:34 UTC
Current behavior - not selecting next occurrence after replace - is intended behavior. It also doesn't jump in editor view, because some user want to have a time to check replace. 

However, I believe it's interested suggestion, therefore I change this to enhancement and I will create a checkbox or a button to say that you want replace and then find.
Comment 5 Milutin Kristofic 2011-10-26 14:53:26 UTC
*** Bug 152128 has been marked as a duplicate of this bug. ***
Comment 6 _ gtzabari 2011-11-06 00:03:57 UTC
I disagree with the current behavior. If the next match is within view (no scrolling needed) then the editor should highlight it. There is no good reason not to. Currently (dev build 201110050601) nothing gets highlighted. There is no indication where the caret is. The user has no way of knowing where he/she is...
Comment 7 tbrunhoff 2011-11-06 03:11:40 UTC
Thanks for chiming in. I think there far more weight should be given to existing editors and what they do... which is not what NB currently does.

Note that the editor does in fact select the next element for replacement, but it does not highlight it.  Since the point of the selection is to give visual confirmation to the user, that confirmation is missing.
Comment 8 Milutin Kristofic 2011-11-07 10:10:36 UTC
(In reply to comment #6)
> I disagree with the current behavior. If the next match is within view (no
> scrolling needed) then the editor should highlight it. There is no good reason
> not to. Currently (dev build 201110050601) nothing gets highlighted. There is
> no indication where the caret is. The user has no way of knowing where he/she
> is...

No there is a good reason not to highlight next match, and that is if I highlight next match, after closing replacebar the caret is after highlighted text and not after replaced text, where IMHO should be.
Comment 9 rafschietekat 2011-11-07 21:12:52 UTC
(In reply to comment #7)
> Thanks for chiming in. I think there far more weight should be given to
> existing editors and what they do... which is not what NB currently does.
There is in fact a respectable precedent for my suggestion to have 3 separate buttons Find, Replace+Find and Replace. Replace+Find does exactly what it says (combine the actions of the two others); it will likely be used most often (meriting its own button, currently called just Replace), but pure Replace is still available to be able to do post-editing around a replaced string without jumping through hoops (the dialog must be non-modal). The selection after closing the dialog is determined by which button was clicked last.

(Oh, and I would still like a Find Previous button in there, as for the plain Find dialog, because checking a box to change direction is too much trouble. And no, that doesn't mean there should be a "Replace+Find Previous" button.)
Comment 10 tbrunhoff 2011-11-08 05:31:23 UTC
> No there is a good reason not to highlight next match, and that is if I
> highlight next match, after closing replacebar the caret is after highlighted
> text and not after replaced text, where IMHO should be.

Perhaps you are also responsible for the behavior of the search. That is,
 - type ^f to start a search
 - type in a known string below the current search window. The view changes as you type.
 - Now either (a) hit escape, or (b) hit return and then hit escape

If you choose (a) your view warps back to where you were before the search. If you hit return, *nothing* changes on the display, but when you then hit escape, you remain where the search left you.

This behavior and the one being discussed in this bug are in the category of surprising the user. Part of the surprise comes from a user model established well before netbeans existed. Consider a survey of other editors that have a "replace" operation.
 - Thunderbird email editor: "replace" replaces the current selection and does not move to the next; "Replace and Find" replaces the current selection and selects the next occurence.
 - Microsoft word: "replace" replaces the current selection and selects the next occurence. There is no button to replace and not change the selection.
 - Eclipse: "replace" replaces the current selection and does not move to the next; "Replace/Find" replaces the current selection and selects the next occurence.
 - Netbeans 7.0.1 on windows (interestingly enough):  "replace" replaces the current selection and selects the next occurence. There is no button to replace and not change the selection.

You have to conclude that (a) linux netbeans 7.1 changes the replace model not only from 7.0.1 but from other influential editors, and (b) the linux netbeans 7.1 "replace" button is really a "Find next and replace" rather than a "Replace and find next".

You are too late to change the world. Please do what other editors do.
Comment 11 tbrunhoff 2011-11-08 05:41:11 UTC
> There is in fact a respectable precedent for my suggestion to have 3 separate
> buttons Find, Replace+Find and Replace.

I think this is an excellent idea. Just note that the current UI visually and logically implements "Find+Replace", not "Replace+Find".
Comment 12 Milutin Kristofic 2011-11-08 10:36:32 UTC
Ok, it is regression -> Bug #204820 is fixed today.