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 214986

Summary: Replace search checkboxes with icons and Add "Replace Last" action
Product: editor Reporter: Petr Somol <psomol>
Component: SearchAssignee: Milutin Kristofic <mkristofic>
Status: RESOLVED WONTFIX    
Severity: normal CC: JPESKA, ulfzibis
Priority: P3 Keywords: PLAN, UI, USABILITY
Version: 7.2   
Hardware: PC   
OS: Windows 7   
Issue Type: ENHANCEMENT Exception Reporter:
Bug Depends on: 214807    
Bug Blocks: 141952, 215062    
Attachments: Proposed extension of buttons in Search&Replace bar
new replace icons
Proposed extension of buttons in Search&Replace bar
Screenshot buttons no text
Proposed patch for buttons without text.
sublime text search and replace bar
New Find actions icons
new icons
20.2.2013 New Searchbar

Description Petr Somol 2012-06-29 12:25:31 UTC
Created attachment 121554 [details]
Proposed extension of buttons in Search&Replace bar

Current replace bar functionality (7.2 rc1) is as follows. Intending to replace string A by string B, I press Ctrl-H to open the Search&Replace bar. I start to type the string A in Find: field. This actually highlights the first occurrence of A. Now I type the string B in Replace: field.

Now pressing Replace replaces the highlighted occurrence of A by B, and highlights (and scrolls to) next A occurrence. This behavior is fine as long as I still need replacing. But at the moment when I know that the last occurrence of A that I intend to replace is highlighted, I want to replace it by B and to stay with cursor in this very place. But the current Replace moves me furhter what was not desired by me at this moment.

This situation is treated in many editors (see e.g. UltraStudio) by "Replace Last" action. Invoking Replace Last instead of Replace does the replacement but does not find the next occurrence.

I suggest to provide this functionality in NB search&replace bar as well. 
Actually such a change would work well together with the enhancement proposed in issue #214807. See the attachment for illustration of how the new Replace Last button, together with supplied icons for Replace, Replace All and Replace Last and together with the new Open in Search Results Window button fit together.

I am also going to attach the new icons in separate attachment.

Remark: a possibly related discussion was held in issue #203269 but I am following the current observable behavior which seems different from the one described in #203269.
Comment 1 Petr Somol 2012-06-29 12:27:51 UTC
Created attachment 121555 [details]
new replace icons
Comment 2 ulfzibis 2012-06-29 16:41:40 UTC
(In reply to comment #0)
> Created attachment 121554 [details]
> Proposed extension of buttons in Search&Replace bar

I would change the position of "Replace Last" with "Replace All", as the latter goes further.

(In reply to comment #1)
> Created attachment 121555 [details]
> new replace icons

Maybe you like the alternative design draft from bug 41952, using fruits.
Comment 3 ulfzibis 2012-06-29 16:42:55 UTC
Oops, correction: bug 141952
Comment 4 ulfzibis 2012-06-29 16:48:09 UTC
Additionally please compare with bug 146818 and sophisticated find/replace dialogue from NotePad++.
I would appreciate to combine all good stuff together in NetBeans IDE.
Comment 5 Petr Somol 2012-07-02 08:58:17 UTC
Created attachment 121646 [details]
Proposed extension of buttons in Search&Replace bar

Good point about Last/All order, I've modified the attached proposal. The other ideas will be reviewed, yet the extensive functionality in Notepad++ is not realizable in a search bar and as such might probably be a topic of a separate enhancement request.
Comment 6 ulfzibis 2012-07-02 10:21:59 UTC
(In reply to comment #5)
> Good point about Last/All order, I've modified the attached proposal.
Fine.

2 additional comments on your extension screen shot:
- In fact, "Last" is "Replace" and "Replace" is "Replace & Find" (or "Find & Replace")
- I would not waste 2 lines for the buttons, so if horizontally there is not enough space, buttons should be without text, but text should be displayed as tool tip while hoovering over the buttons. (maybe same for the checkboxes: cut the text to fit into the available space, but show complete text in tool tip)

> yet the extensive functionality in Notepad++ is not realizable in a search
> bar and as such might probably be a topic of a separate enhancement request.
Yes, correct, this was meant for the dialogue case.
But anyway, as I'm VERY MUCH missing a smart way to match on line borders etc., I beg for including a tiny option from Notepad++ in both, dialogue + search bar:
- a checkbox to allow '\l', '\r', '\t' interpreted as LF, CR, TAB, maybe extended for all Java String '\'-escapes ... bug 148989.

Maybe also have a look at bug 148984. Is it still valid?
Comment 7 Milutin Kristofic 2013-02-12 15:11:34 UTC
Created attachment 131298 [details]
Screenshot buttons no text

I implemented different buttons - without text and no border as in toolbar buttons. I am looking for evaluation. if I should commit this change. 

Look at screenshot
Comment 8 Milutin Kristofic 2013-02-12 15:13:48 UTC
Created attachment 131299 [details]
Proposed patch for buttons without text.

Added Proposed patch for buttons without text.
Comment 9 ulfzibis 2013-02-12 19:04:56 UTC
1. I'm missing the "Replace Last" button.

2. Please look for a solution, fitting all in 1 line, as modern wide screens, especially on laptops, often are humble in vertical space.

3. I would order the fields and buttons as follows:
- Find: [Search Field] (no "What")
- [Button] with tool tip "Find previous"
- [Button] with tool tip "Find next"
- Replace: [Replace Field] (no "With")
- [Button] with tool tip "Replace( only this)" aka "Replace Last"
- [Button] with tool tip "Replace & Find next"
- [Button] with tool tip "Replace all"
- Checkboxes ...

4. List the checkboxes as many, as space available in 1 line, and open the "More ..." dialogue on mouse hover.
Alternative: checkboxes without text or just a small icon and display text as tool tip.

5. Where is the button to open the regular Find & Replace dialogue?

6. We should discuss, if the checkbox selections should be copied to/saved for the regular Find & Replace dialogue.

7. Discussion: "More ..." could display the regular Find & Replace dialogue.
Comment 10 ulfzibis 2013-02-12 19:10:28 UTC
8. If the regular Find & Replace dialogue is displayed and user hits one of the buttons in the tool bar, the regular Find & Replace dialogue should close automatically.
Comment 11 Milutin Kristofic 2013-02-13 15:38:31 UTC
Created attachment 131354 [details]
sublime text search and replace bar

mk1: I am suggesting that netbeans should have icons instead of checkboxes for match case, whole word, regular expresion etc. I would be happy with similar solution as sublime text in attachment.
Comment 12 Milutin Kristofic 2013-02-13 15:54:32 UTC
u1: Replace last will be in 8.0. I just forget to add it.

u2, u3, u4: I think 1 line would be too crowded. 2 lines are much better. You have default find and you just visually added replace functionality. You can close it if you don't have vertical space. You can turn off toolbars, etc. I don't see a point to have one line find, replace. Is there editor with one line?

u5, u6, u7: Editor search and Project search already share search history (also replace), but they have quite different case uses and different workflow. I don't like adding more connection between them. 

u8: there is already special option for this in netbeans options.
Comment 13 ulfzibis 2013-02-14 02:38:18 UTC
(In reply to comment #11)
> mk1: I am suggesting that netbeans should have icons instead of checkboxes for
> match case, whole word, regular expresion etc. I would be happy with similar
> solution as sublime text in attachment.

Great, then we would have enough space to fit all in 1 line ;-)

(In reply to comment #12)
> u2, u3, u4: I think 1 line would be too crowded. 2 lines are much better. You
> have default find and you just visually added replace functionality. You can
> close it if you don't have vertical space. You can turn off toolbars, etc. I
> don't see a point to have one line find, replace.

Then please add an option to switch between both, so next NetCAT testers could share there opinion.
Also people with small screens want to benefit from the smart Find & Replace bar, so switching off is not an option.

What you think about my text changes, without "what", "with", "last" after "Replace", but "Replace & Find next"

> Is there editor with one line?

Is this a real criteria?
BTW, there ore other good solutions, e.g. in Notepad++, which NB IDE is still lacking: bug 146818, bug 148989.
Comment 14 Petr Somol 2013-02-14 09:21:47 UTC
Sidenote: we are mixing several Enhancements in this issue. Milo, would you please file separate issues for each of the new topics and keep here just the "Replace Last" issue ? The new ones would cover: replace checkboxes by pushbuttons while considering the reordering to the left from search fields (open question imho), and a separate issue would be the optional arrangement of search & replace to one line - this one would then block Issue #209259.
Comment 15 Jan Peska 2013-02-19 15:07:01 UTC
Created attachment 131573 [details]
New Find actions icons

Here are new icons proposal. Mito please integrate them and attach a screenshot to let us see if they fit in.
Comment 16 Milutin Kristofic 2013-02-19 16:18:47 UTC
Created attachment 131576 [details]
new icons

Ok, I attach screenshot of findbar with new icons
Comment 17 Milutin Kristofic 2013-02-19 16:22:25 UTC
Ralph had a comment that quotes in whole words and dot with star in regexp are too much separated therefore it looks there are different icons.
Comment 18 Petr Somol 2013-02-19 16:31:40 UTC
(In reply to comment #17)
> Ralph had a comment that quotes in whole words and dot with star in regexp are
> too much separated therefore it looks there are different icons.

True, we could not find out better representation of these choices so far when we discussed this with Honza. Any suggestion for alternatives is welcome. Should we stay with the current icons though, there might perhaps be some chance to find some graphic trick how to make the contents of each icon look less torn apart.. ideas in this direction are welcome as well..
Comment 19 Milutin Kristofic 2013-02-20 16:13:48 UTC
Created attachment 131624 [details]
20.2.2013 New Searchbar

Recent version of new searchbar. Any comments?
Comment 20 ulfzibis 2013-02-20 16:31:44 UTC
(In reply to comment #19)
> Recent version of new searchbar. Any comments?

Where are Replace field and it's buttons?
I like the substitution of the check boxes by bi-stable buttons!
Are they commented by a tool tip?
Comment 21 Milutin Kristofic 2013-02-20 16:36:31 UTC
I am waiting for replacebar icons. The buttons are now Jtogglebutton - same as rectangular edit in toolbar. There are tooltips.
Comment 22 Milutin Kristofic 2013-02-21 15:22:09 UTC
1, I push to dev version searchbar with icons. http://hg.netbeans.org/jet-main/rev/978c289a27d5

2, Replacebar icons will be added as soon as I receive images. I will also add Replace last action

3, There is still need for icon for selection (Bug #219536)

4, I created new enhancement for optional one line replacebar (Bug #226469)
Comment 23 ulfzibis 2013-02-22 00:15:25 UTC
5, Consider bug 226491

I still worry about the naming of "Replace Last"
This could be misunderstood as "Replace (only) the last occurrence of the search pattern".
The real action which is meant is "Replace, but do not find next"
If you don't want to rename the standard "Replace" action to "Replace & Find Next", you could name it "Replace Only". To me this seems more precise than "Replace Last".
Comment 24 Quality Engineering 2013-02-24 05:44:56 UTC
Integrated into 'main-golden', will be available in build *201302232300* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/978c289a27d5
User: Milutin Kristofic <mkristofic@netbeans.org>
Log: #214986 - Replace search checkboxes with icons and Add "Replace Last" action
Comment 25 rogojine 2013-11-29 17:11:49 UTC
After several week of usage, I think this is a notable regression in usability.
I'm not commenting the "Replace Last" part, which is mixed in this ticket.

I see no gain in using icons in the search toolbar. It is more compact, but even small screens had enough horizontal space for the text that was in NB7.3.

Now for the regressions:
1. Harder to identify at first glance. My mind has to recognize a small icon and convert it to an non-obvious text equivalent. I still need to use the mouse and see the tooltips from time to time!
2. Harder to select if you don't know the shortcuts. No keyboard navigation, and the mouse click has a tiny target (less than 4 sq. mm on my screen). Some icons are too similar (whole word / regex).
Comment 26 Martin Balin 2016-07-07 07:29:03 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss