Tracker: Patches

5 "Whole word" option does not work in Replace - ID: 3543524
Last Update: Comment added ( jarekczek )

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


Malathi ( Malathi ) - 2012-07-13 06:34:37 PDT

5

Closed

Accepted

Jarek Czekalski

texteditor

None

Public


Comments ( 8 )

Date: 2012-07-31 12:05:44 PDT
Sender: jarekczek

r21965


Date: 2012-07-30 00:04:51 PDT
Sender: jarekczek

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.


Date: 2012-07-29 23:33:57 PDT
Sender: Malathi

Ya it is a mistake. No need for that condition. Do i have to submit the
patch again without this condition?


Date: 2012-07-29 23:00:35 PDT
Sender: jarekczek

Are you saying: "it's a mistake"?


Date: 2012-07-29 17:45:35 PDT
Sender: Malathi

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


Date: 2012-07-29 11:24:55 PDT
Sender: jarekczek

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?


Date: 2012-07-27 10:56:46 PDT
Sender: jarekczek

This is a patch for bug #3543524
https://sourceforge.net/tracker/index.php?func=detail&aid=3522497&group_id=588&atid=100588


Date: 2012-07-13 23:39:27 PDT
Sender: Malathi

Hey I am creating this patch with the version 4.5.2


Attached File ( 1 )

Filename Description Download
Patch Patch Download

Changes ( 6 )

Field Old Value Date By
status_id Open 2012-07-31 12:05:44 PDT jarekczek
resolution_id None 2012-07-31 12:05:44 PDT jarekczek
close_date - 2012-07-31 12:05:44 PDT jarekczek
assigned_to nobody 2012-07-29 11:24:55 PDT jarekczek
summary "Whole word" option does not work in Replace - ID: 3522497 2012-07-13 23:39:27 PDT Malathi
File Added 448837: Patch 2012-07-13 06:34:41 PDT Malathi