issue-#150 improvements in DevSearch

Merged to the master branch
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

issue-#150 improvements in DevSearch

Post by Josef Templ »

I have created issue-#150 for improvements in DevSearch.
For the issue see https://redmine.blackboxframework.org/issues/150.

For the changes see https://redmine.blackboxframework.org/p ... 09ddc6ad20.

The string 'Search for' is now mapped.

The changes in DevSearch.Find remove redundant Kernel.Upper calls by
storing upper case characters in the buffer 'ref' instead of
converting them again and again when using it from the buffer.
Please note that the changes in Find will crash the system when doing a case insensitive search
unless the fix for Kernel.Upper (issue-#149) is in use!

The mapping keys Location, Count, Searching, and NoMatchFound
appear in both Std/Rsrc/Strings and Dev/Rsrc/Strings.
In one of them they are redundant. Which one?
So far DevSearch used Std, but Dev seems more appropriate to me.
Interestingly, the keys OpenFindCmd and OpenFindCmdNotFound were in Dev
(but they are now redundant anyway.)
I have used them from Dev and removed them from Std.

Some small changes have been necessary also in TextCmds and Text menus.
The behavior of text search (First / Again) was very special so far
and not easy to explain. I think that with the current
solution it is easier and more convenient.
The rule is: if and only if the search text changes (the text in the Find /Replace dialog)
then the search options are reset. This was also part of the previous solution
but it did not work that way in detail. There were additional rules and at least one bug
(viz. the field reverseOrientation was not reset).
The newly implemented behavior now allows us to use F3 (Find Again) when
opening a link from a search result list no matter if the search was case sensitive or not.
The old solution did not allow using F3 for case insensitive search because it
reset the ignoreCase option even when the search string did not change.
That was the reason for opening the search dialog.

- Josef
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#150 improvements in DevSearch

Post by DGDanforth »

Josef,

If we are making changes to DevSearch then I strongly request
that it work with "attributed strings".

By that I mean, for example if one searches for "apple" then the search
only stops at those words "apple" which have their "pp" letters bold.
Searching for color, strike through, underline, etc. combinations should be supported.
Replacements should also support attributes. For example
Find: impact
Replace: impact affect
(since phpBB doesn't support strike through I used underscore)

The way one has to do that now is to create an instance of the Replace string, copy it Ctrl-C (to the clipboard),
highlight the Find string, search F3 for the Find string and then do paste (Ctrl-V). The F3, Ctrl-V sequence must be done over
and over again for each instance desired to be replaced. Left hand up to F3, Left hand down to Ctrl and hold
while right hand hits V. Too much motion.

With attributed strings supported, only a single button push is needed for each instance.
Much nicer.

An option "Ignore attributes" would be added to the Find/Replace tool.
That option would apply only to the Find: string. The Replace: string would always
use attributes if the replace string has them.

Right now I need to replace letters in a text with their colored version (red, or green).
That is for the game Jotto. But there are many other instances where I need
attributed strings.

-Doug
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#150 improvements in DevSearch

Post by Robert »

Doug

The module CpcSearch (which used to be on the CPC site) does all that; I can send you a copy if you need to use it.

I fully expect it to be republished within a very few weeks.

But it is much more complicated than the standard search / replace, and will not be to everyones taste. Some people will want full regular expressions (modules that do that are also available, I believe) for example.

So I think we should stay with a simple standard Tool, and keep these more sophisticated tools as external options that users can install as they wish.
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#150 improvements in DevSearch

Post by DGDanforth »

Robert wrote:Doug

The module CpcSearch (which used to be on the CPC site) does all that; I can send you a copy if you need to use it.

I fully expect it to be republished within a very few weeks.

But it is much more complicated than the standard search / replace, and will not be to everyones taste. Some people will want full regular expressions (modules that do that are also available, I believe) for example.

So I think we should stay with a simple standard Tool, and keep these more sophisticated tools as external options that users can install as they wish.
OK, I can wait for its re release. Thank you Robert.
-Doug
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#150 improvements in DevSearch

Post by Josef Templ »

DGDanforth wrote:Josef,

If we are making changes to DevSearch then I strongly request
that it work with "attributed strings".

By that I mean, for example if one searches for "apple" then the search
only stops at those words "apple" which have their "pp" letters bold.
Searching for color, strike through, underline, etc. combinations should be supported.
Replacements should also support attributes. For example
Find: impact
Replace: impact affect
(since phpBB doesn't support strike through I used underscore)

The way one has to do that now is to create an instance of the Replace string, copy it Ctrl-C (to the clipboard),
highlight the Find string, search F3 for the Find string and then do paste (Ctrl-V). The F3, Ctrl-V sequence must be done over
and over again for each instance desired to be replaced. Left hand up to F3, Left hand down to Ctrl and hold
while right hand hits V. Too much motion.

With attributed strings supported, only a single button push is needed for each instance.
Much nicer.

An option "Ignore attributes" would be added to the Find/Replace tool.
That option would apply only to the Find: string. The Replace: string would always
use attributes if the replace string has them.

Right now I need to replace letters in a text with their colored version (red, or green).
That is for the game Jotto. But there are many other instances where I need
attributed strings.

-Doug
Doug, I can understand this request indeed. Sometimes I also wish to be able to search
for attributes, etc. The problem is that this is a fairly complex extension
and it is not clear to me how the user interface would look like and what exactly
it is doing in particular with Replace.
(It would also not be in DevSearch but in TextCmds, but that's a detail.)
The current changes are a small step only but to me a clear improvement
over the previous situation.
As a preparation for further extensions of the find attributes I have
now refactored resetting the find attributes into a separate procedure ResetFindDialog.
See diffs at https://redmine.blackboxframework.org/p ... bd1220a5d9.

I have not looked into the mentioned CpcSearch extension yet but
will look at it when it is republished.
Another source of inspiration may be MS Word, which does support
attribute search.

- Josef
User avatar
Robert
Posts: 1024
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#150 improvements in DevSearch

Post by Robert »

Josef Templ wrote:Doug, I can understand this request indeed ... problem is that this is a fairly complex extension ...
The current changes are a small step...
I suspect that what makes a good search / replace tool comes down to both personal preference, and the nature of today's task. Is a simple tool sufficient, or is a more sophisticated but complex tool required?

Maybe a small step is to make the tool some kind of extensible or reconfigurable object. A simple default implementation would be provided, as at present, but it could be reconfigured in the users preferences somehow, and then whenever the generic search / replace tool is invoked, the users selected implementation would be used.

As you can guess, I haven't looked at the details.

One specific comment about my search / replace tool. I do use the sophisticated wildcard and attribute functions, but really quite rarely. What I do appreciate every day is that the search & replace fields are both dropdown controls that automatically keep the last 10 strings used.
Zinn
Posts: 476
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main
Contact:

Re: issue-#150 improvements in DevSearch

Post by Zinn »

All header line should have the number #150 instead of #88
- 20170309, center #88, improvements in DevSearch

Why is there no Dialog.Update(TextCmds.find); in the procedure SelectFirst ?
I have the same question about procedure GetFindPattern in TextCmds.
Behind the Dialog.Update in ResetFindDialog form values are changed again.

I just start to look at this changes and test it
Helmut
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#150 improvements in DevSearch

Post by DGDanforth »

Josef,
Thank you for looking at this.

I see no change in the Find/Replace interface dialog tool (ignore attributes is not necessary)
The fill-in fields simply support TextModels.Model.

@Robert, hmm I don't think I need those functionalities.
User avatar
DGDanforth
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA
Contact:

Re: issue-#150 improvements in DevSearch

Post by DGDanforth »

DGDanforth wrote: I see no change in the Find/Replace interface dialog tool.
That comment needs modification.
Controls does not have a Text Field so that would need to be added (extend Controls).
The Find/Replace would then need to use Text fields.
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#150 improvements in DevSearch

Post by Josef Templ »

Zinn wrote:All header line should have the number #150 instead of #88
- 20170309, center #88, improvements in DevSearch

Why is there no Dialog.Update(TextCmds.find); in the procedure SelectFirst ?
I have the same question about procedure GetFindPattern in TextCmds.
Behind the Dialog.Update in ResetFindDialog form values are changed again.

I just start to look at this changes and test it
Helmut
Thanks for the hints.
Fixed now. see https://redmine.blackboxframework.org/p ... 28f420e446.

- Josef
Post Reply