issue-#150 improvements in DevSearch

Merged to the master branch

issue-#150 improvements in DevSearch

Postby Josef Templ » Thu Mar 09, 2017 9:28 pm

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/projects/blackbox/repository/diff?utf8=%E2%9C%93&rev=04b0ce68e3fc396c3045715c1a69b6bd1220a5d9&rev_to=7319f0e785b9b0ca10dd67b27dbfb209ddc6ad20.

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
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#150 improvements in DevSearch

Postby DGDanforth » Fri Mar 10, 2017 8:46 pm

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
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: issue-#150 improvements in DevSearch

Postby Robert » Fri Mar 10, 2017 8:59 pm

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
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#150 improvements in DevSearch

Postby DGDanforth » Fri Mar 10, 2017 9:29 pm

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
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: issue-#150 improvements in DevSearch

Postby Josef Templ » Sat Mar 11, 2017 8:49 am

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/projects/blackbox/repository/diff?utf8=%E2%9C%93&rev=05a5fa4816accea03f99a09fbcb36028f420e446&rev_to=04b0ce68e3fc396c3045715c1a69b6bd1220a5d9.

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
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Re: issue-#150 improvements in DevSearch

Postby Robert » Sat Mar 11, 2017 9:03 am

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.
User avatar
Robert
 
Posts: 1023
Joined: Sat Sep 28, 2013 11:04 am
Location: Edinburgh, Scotland

Re: issue-#150 improvements in DevSearch

Postby Zinn » Sat Mar 11, 2017 3:00 pm

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
Zinn
 
Posts: 472
Joined: Tue Mar 25, 2014 5:56 pm
Location: Frankfurt am Main

Re: issue-#150 improvements in DevSearch

Postby DGDanforth » Sat Mar 11, 2017 10:35 pm

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

Re: issue-#150 improvements in DevSearch

Postby DGDanforth » Sun Mar 12, 2017 2:19 am

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
DGDanforth
 
Posts: 1061
Joined: Tue Sep 17, 2013 1:16 am
Location: Palo Alto, California, USA

Re: issue-#150 improvements in DevSearch

Postby Josef Templ » Sun Mar 12, 2017 7:37 am

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/projects/blackbox/repository/diff?utf8=%E2%9C%93&rev=3dc40734603cf32e75c7c3a445d22b15cc1c3074&rev_to=05a5fa4816accea03f99a09fbcb36028f420e446.

- Josef
User avatar
Josef Templ
 
Posts: 2038
Joined: Tue Sep 17, 2013 6:50 am

Next

Return to Resolved (Features)

Who is online

Users browsing this forum: No registered users and 1 guest

cron