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 269726

Summary: Click inside code / text editor having the "Find in document" area open (CTRL+f) takes cursor into the Find text field
Product: editor Reporter: Pere
Component: Actions/Menu/ToolbarAssignee: Miloslav Metelka <mmetelka>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P1    
Version: Dev   
Hardware: PC   
OS: Windows 7 x64   
Issue Type: DEFECT Exception Reporter:

Description Pere 2017-02-02 16:51:41 UTC
I've been using Netbeans for ages (version 6 at least) and this happens since 1st time I used this IDE. I CAN'T BELIEVE THIS STILL HASN'T BEEN FIXED, and that when I look for this bug I cannot find it as an open bug, being as it's obvious that this bug exists, it affects to the main, most important part of the IDE (the text editor) and abviously lots of users are experiencing this.

This goes this way: suppose you once pressed CTRL+f to search (Find) for some text in the current opened / being edited file. NOT RIGHT-CLICK ON YOUR PROJECT ROOT FOOLDER AND "Find". No. You are writing your code on an open file, with your cursos active inside it, and you press CTRL+f. An area appears at the bottom of your file where you have a text input to enter what you want to find, and some controls like "Previoius" and "Next", for moving between multiple occurrences and so. Ok. You made your search and happily you continue writing your code. You do some other things. Maybe check something in a browser. Select something from some menu. Whatever.

Then you click again on the editor to place the cursor where it was last time you wrote your last word or piece of code. The cursor may even actually BLINK at the position where you clicked! You happily start typing the next sentence you had in your main. You are looking at your keyboard instead of your screen as you want to spit directly what you had on your mind and don't want to make any typo...

...then you put your eyes on the screen and discover that, magically, the cursor has gone inside the "Find" text field, the code you wrote is there, and that's not all! If the letters you wrote happen to match with some of the already existing text inside the editor, the "finder" has gone to that line of code, maybe hundreds of lines above or below the one you were supposed to be writting, having to locate again where you were last time, and having to rethink what you were typing, and having to restart your thinking process again and getting a lot of frustration and unproductiveness, cursing Netbeans and all the development team.

It's not acceptable that an IDE have such a bug and that it still exist around for so many years. Why I can't find this in the open bugs database? IT HAS HAPPENED ON EVERY INSTALLATION OF NETBEANS I'VE DONE IN MY ENTIRE LIFE. Currently I'm using version Dev 201611220001 on Windows 7 x64. I cannot remember if it also happens in my Linux machine. 

It disrupts the programming task; it produces lots of frustrating, causes programming errors, moves you away from the line of code you where editing... 

It even happens when you click on the editor, place the cursor inside it and press CTRL+v planning to paste some text or code you copied from somewhere... You **SEE** the cursors blinking on the editor, you press CTRL+v... wonders where on hell the text you pasted and the cursor went... and suddenly you notice it went to the "Find" text field, and LINES of code are there, and you have to press CTRL+a and then Del to remove that rubbish...

This is the STINKEST of the bugs I've seen on a single piece of software, and no single reference to it appears in the bug database... What a mistery...
Comment 1 Pere 2017-02-21 12:41:56 UTC
*** Bug 262537 has been marked as a duplicate of this bug. ***
Comment 2 Pere 2017-03-10 12:15:15 UTC
Ok, concentrating on how to reproduce this I discovered this seems to involve having the screen split in several editors, and even anyone could argue (?) this is not really a bug but a feature?

Steps to reproduce it:

1) Have your screen divided in half in two text editors, one with mainfile.java, at the left, and another one, secondaryfile.java, to the right.

2) Click on mainfile.java, press ctrl+f, do a search for a string which matches something. 

3) Click on secondaryfile.java, anywhere in the code.

Instead of placing the cursor there, the Find: text input ((which disappeared from mainfile.java when you switched editor) will appear there, 
and the string you searched for in mainfile.java will be highlighted, thus placing the cursor there.

Another way of reproducing it:

1) Go to your project tree, right-click in the folder which holds secondaryfile.java and search for a string you know its there.

Below in your screen the results from the searched text will appear.

2) Go to mainfile.java, click somewhere on the editor, open Find in file if it wasn't already open. Click inside the text input and place a text you know exists in the current editor. Current match(es) will appear highlighted in orange (or blue if in commented code areas).

3) Double click on a match in the Find... in project window below, where the find results were. 

Cursor will go to the secondaryfile.java editor, but instead of putting itself in the code area where the string was found, it goes to the Find input text, highlighting the last search you attempted on that editor.

3b (bonus)) Click on mainfile.java, anywhere inside the editor. Again, cursor will go inside the Find: input, not where you clicked on. Very annoying.

Proposed solution / related behaviour: Netbeans should only keep/remember status of the "Find:" input text for open file for the editor tab belonging to the file where you actually opened it, and not moving/translating this state to the current tab you switch to. If I use ctrl+f in mainfile.java, I want it to be kept open there, not opening it in secondaryfile.java if I switch to that tab/file. And/or, of course, not going there if I click from a Find... in project search result; maybe it should go to the beginning of the line containing the occurence, or to the beginning or the end of the string, or wherever, but not inside the Find: input.
Comment 3 Miloslav Metelka 2017-03-29 14:04:30 UTC
It should be fixed by
http://hg.netbeans.org/jet-main/rev/0e83cbf17195
It should work fine at least for Find Usages, Find-in-projects and Navigator clicks on Linux (hopefully there won't be any focus change specific subtleties on other platforms).
Btw I've also entered issue #270242 for search text field content change.
Comment 4 Quality Engineering 2017-03-31 01:50:23 UTC
Integrated into 'main-silver', will be available in build *201703310002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/0e83cbf17195
User: Miloslav Metelka <mmetelka@netbeans.org>
Log: #269726 - Click inside code / text editor having the "Find in document" area open (CTRL+f) takes cursor into the Find text field.
Comment 5 Milutin Kristofic 2017-04-03 14:02:36 UTC
*** Bug 269890 has been marked as a duplicate of this bug. ***
Comment 6 Pere 2017-06-15 11:02:44 UTC
I'm still experiencing this a lot on Dev 201705310001, and also the "related" (or "duplicated", as you stated) bug at in the comment above, which I also reopened.