Problem:
Trying to replace all occurrences of "debug_client" with "DebugClient", when the "Whole word" option is selected in the Search&Replace dialog, causes also partial word replacements. E.g. both of the following were replaced:
genericapi: debug_client
genericapi_all: debug_client_all
Note that in the 2nd line, debug_client does not appear as a whole word.
Patch:
The _replace() method in SearchAndReplace.java file noWordSep is assigned with wordBreakChars. So i changed it to assign noWordSep
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
Patch
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
Hey I am creating this patch with the version 4.5.2
This is a patch for bug #3543524
https://sourceforge.net/tracker/index.php?func=detail&aid=3522497&group_id=588&atid=100588
Malahti, you found and fixed an evident bug. Thanks for that. But I wonder if this change is good:
- if (noWordSep == null)
+ if (noWordSep == null || noWordSep.isEmpty())
That means that user will not be able to treat _ as a non-word character. Even if he leaves "Extra word characters" empty, the underscore will still be treated as being part of the word. _ is a default "Extra word character" (see jedit.props), isn't it enough?
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
The reason I included "noWordSep.isEmpty()" is that before changing WordBreakChars to noWordSep in _replace() the value that noWordSep get in setNoWordSep is an empty string(because wordBreakChars is empty in jedit.props). At that time if "noWordSep == null" condition only is checked, then noWordSep is assigned with the empty string. To avoid that i included "noWordSep.isEmpty()" condition as a precautionary. If I am wrong clarify me. Thanks
Are you saying: "it's a mistake"?
View and moderate all "patches Discussion" comments posted by this user
Mark all as spam, and block user from posting to "Patches"
Ya it is a mistake. No need for that condition. Do i have to submit the patch again without this condition?
I'll change it manually, no need to resubmit.
Regarding wordBreakChars: it is set by mode. So for java files you get ,+-=<>/?^&*
by buffer.getProperty("wordBreakChars") in BeanShell console. That means that a in a+b was not treated as a separate word and your patch will fix it as well.
r21965