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 123539 - Underscore character incorrectly treated in find/replace
Summary: Underscore character incorrectly treated in find/replace
Status: RESOLVED FIXED
Alias: None
Product: editor
Classification: Unclassified
Component: Search (show other bugs)
Version: 6.x
Hardware: PC Linux
: P3 blocker (vote)
Assignee: Alexey Butenko
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-12-06 06:53 UTC by richbl
Modified: 2009-04-22 11:31 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description richbl 2007-12-06 06:53:53 UTC
When performing a find/replace in a .rb file, the underscore character (_) is treated as a word delimiter.

Does:
0) open .rb file for editing
1) from the Edit menu, choose Replace
2) in the Find What textbox, type @exercises
3) in the Replace With textbox, type @exercises_current
4) note the Whole Words checkbox is enabled (checked)
5) click the Find button

Note that @exercises_xyz is replaced with @exercises_current_xyz. The Whole Words feature does not appear to work as
expected.

Should:
When Whole Words is enabled (checked), words containing underscore characters are treated as whole words). The
underscore character (_) should not be treated as a word delimiter.
Comment 1 Petr Jiricka 2008-03-31 00:48:16 UTC
Reproduced. Also happens for other files, e.g. Java. Reassigning to core editor. 
Comment 2 Jiri Prox 2008-04-11 00:42:28 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 3 Alexei Mokeev 2009-04-13 09:34:05 UTC
'_' character is a word delimiter. And it's treated as a word delimiter in other popular editors as well.
Just check with gedit and Open Office - the behavior is identical to NetBeans. 
Comment 4 Torbjorn Norbye 2009-04-13 15:56:17 UTC
Sorry - OpenOffice and gedit aren't code editors.

The Java spec is very clear that _ is a -part- of a name, not a delimiter.  foo_bar is one word in Java. It makes sense
for possibly vi and emacs to treat this as two words, by an IDE should not. 

The IDE has facilities to let each language determine what a word is -- there are finders for looking up the end of the
word (used for next word, prev word etc. navigation, double click selection, etc). The search/replace mechanism really
should be using the same facility to determine wholewordness.
Comment 5 Alexei Mokeev 2009-04-14 09:52:44 UTC
You are right. Just checked the word boundary definition in case of Java and it doesn't include '_'.
Comment 6 Alexey Butenko 2009-04-22 11:31:15 UTC
changeset 8b06184dddca