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.
Summary: | Find/Replace missing "in selection" option | ||
---|---|---|---|
Product: | editor | Reporter: | theosib |
Component: | Search | Assignee: | Milutin Kristofic <mkristofic> |
Status: | REOPENED --- | ||
Severity: | normal | CC: | AE56, jhcaiced, markiewb |
Priority: | P2 | ||
Version: | 7.1 | ||
Hardware: | PC | ||
OS: | Windows 7 x64 | ||
Issue Type: | ENHANCEMENT | Exception Reporter: |
Description
theosib
2012-01-19 17:32:31 UTC
This is already implemented and automatical. If you selected multilines and start search or replace bar then you search or replace only inside selected text. See: http://blogs.oracle.com/geertjan/entry/hidden_netbeans_feature_search_in It isn't at all clear that this is the case. So that you can meet common expectations about this, you may want to add an option to turn it on or off, or you may want to add "(in selection)" to strategic places to indicate to the user that their action will be confined to the selection. In other words, I'd call this a human factors bug. I will discuss about ui changes to 7.3, but this is more enhancement than bug But it doesn't work with "Regular Expression" option checked. Is this a feature I don't understand (maybe with Regex there is a possibility to tell NetBeans to search only within selection) or there is a bug indeed? Best, (In reply to comment #1) > This is already implemented and automatical. If you selected multilines and > start search or replace bar then you search or replace only inside selected > text. > > > See: > http://blogs.oracle.com/geertjan/entry/hidden_netbeans_feature_search_in It works for me with regexp in 7.2 dev. What's your version sargac? I have a file : word1 word2 word3 select both word1 word2 find: ^word (select regular expression) next is jumping from word1 to word2, not to word3 Product Version: NetBeans IDE 7.1.1 (Build 201203012225) Java: 1.7.0_03; Java HotSpot(TM) 64-Bit Server VM 22.1-b02 System: Windows 7 version 6.1 running on amd64; Cp1252; en_US (nb) Search in selection as per https://blogs.oracle.com/geertjan/entry/hidden_netbeans_feature_search_in works only in multiple lines of code. 6.8 (and I believe 7.0) allowed selection within a single line. This is a breaking change and interferes with usability. (In reply to comment #1) > This is already implemented and automatical. If you selected multilines and > start search or replace bar then you search or replace only inside selected > text. > > > See: > http://blogs.oracle.com/geertjan/entry/hidden_netbeans_feature_search_in It's true. Also it works partially, because you need to toggle on or off the panel on the bottom if you want to change the text selection to do Find/Replace. *** Bug 217312 has been marked as a duplicate of this bug. *** Needs to be obvious in the search panel that is limited to selected text only, and/or allow "selected text" to be turned off and on. I confirm sargac's report (comment 4) that it emphatically does NOT work in 7.4. Replaced a string with some text selected, and it replaced all occurrences in the entire file. Thank goodness for undo! ;) Any news about this feature request? An ide full of features that don'th ave this simple feature :-( This is working, just not obvious enough. If you select text and hit ctrl+h, you'll replace only in this selection. Make sure you select first and hit ctrl+h after, it'll not accept a new selection without "reopening" the replace dialog. (In reply to x3cion from comment #12) > This is working, just not obvious enough. If you select text and hit ctrl+h, > you'll replace only in this selection. Make sure you select first and hit > ctrl+h after, it'll not accept a new selection without "reopening" the > replace dialog. It works if you select more than one line. Try selecting a single line and you'll see a case where it does _not_ work. (With there being more instances of whatever it is you try to search/replace outside of that line). There is a ton of open space in the UI and the solution that was there previously was superior to the current one. I'm struggeling with understanding the reasons for changing it. But at this point that might be a moot point considering the time that has passed and the resistance to change for this particular feature. It doesn't seem to be working properly in Netbeans 8.0 -- I selected a one-line array and did a search and replace, and had to undo because it seemed to execute the replace on the entire document. In 8.0 (not tested in earlier versions) it seems to be completely broken for "rectangular selection". That is, it does not limit the replace to the rectangular selection, but replaces all. In Netbeans 8.1 when Regex is enabled there is no way to enable/disable an "in selection" option, and it doesn't work automatically. In Netbeans 8.1 this feature does not work when selecting a single line. (It will replace all occurrences in the document). Hope it's fixed soon - this feature really should work on an IDE like netbeans! In Netbeans 8.1 this issue is not fixed (In reply to error403 from comment #18) > In Netbeans 8.1 this issue is not fixed @error403: Do not change the version field! It is supposed for the version the issue was reported initially. Vote instead! Reverting the change. I'm running 8.2 over Windows 8.1/64, JRE 1.8.141,, came here to report this same issue and found this ticket. But I've had success with the test case documented below, so this ticket might be a candidate for Fixed/Completed. For a while I was not having success with Ctrl+H, which would be a different issue. I want to reformat a block of PHP comments with RegEx. Example: /** * This can be a very long line which goes beyond line * wrap and comes down to a second line. **/ I want to reformat that to: /** * This can be a very long * line which goes beyond line * wrap and comes down to a * second line. **/ That needs to be done in two parts: Convert the selected block to a single line. Then do a multi-line conversion of that same block to comment lines. First, select "* This" through the period. Ctrl+H. Find: (\s)*\* Replace: .. nothing here ... Click Replace All. In my current configuration, that works, which invalidates this ticket. It also verifies that it works with RegEx, which invalidates one of the notes in this ticket. To continue... The text, now a single line remains selected. Click back in Find: Find: (\b.{1,40})(?:\s+|\n|$) Replace: * $1\n Again, that does work For Me. I recommend that others test this, and if it does not work, be specific about your JRE version, 32/64bit, locale, code language, and any other system-specific nuances that might influence results. HTH |