Recent

Author Topic: Search again  (Read 7638 times)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Search again
« Reply #30 on: October 17, 2020, 04:01:25 pm »
@Juha: Any idea if that could be simplified?
Just leave any options out at least now. It would add complication for very little benefit.
Better and more intuitive would be to support reordering the tabs by user. Is the current PageControl (or something?) easy to replace with the extended notebook? You have best knowledge of it.

The "Search again" in Paolo's popup menu is good. Even better would be to have it in the tab itself, in addition to the TreeView under the tab.
« Last Edit: October 17, 2020, 04:03:07 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Search again
« Reply #31 on: October 17, 2020, 04:12:35 pm »
Better and more intuitive would be to support reordering the tabs by user. Is the current PageControl (or something?) easy to replace with the extended notebook? You have best knowledge of it.
Its a drop in replacement. Should be possible to use the object-inspectors "change class" feature.
It would then need to handle the OnTabDragDrop event (and maybe other OnTab.... events) to make sure the treeviews are correctly associated (not sure how much work is needed there).

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Search again
« Reply #32 on: October 17, 2020, 04:15:57 pm »
The "Search again" in Paolo's popup menu is good. Even better would be to have it in the tab itself, in addition to the TreeView under the tab.
Thats why pdf attachments are not a good idea.
I did not even notice the 2nd page.

And yes, the context menu could even have
* Refresh => searches the same again (no search dialog)
* Modify/Update search (or better name)  => opens the search dialog, and then replace the tab.

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: Search again
« Reply #33 on: October 17, 2020, 04:43:03 pm »
Quote
It only compares the SearchText, not the other search criteria. A user would want to search from different directories, using case sensitive/insensitive, regular expression etc., and have their results in separate tabs

this is partially true, my code leaves separate tabs for example if you enabled or disable "case sensitive" option (see pdf figure (1)), but you are right, it does not recognize some other changed criteria like different path search, thanks to point out this.

here an example

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. begin
  3.   a:=1;
  4.   A:=2;
  5. end;

and annex in the images of 3 tab results

I was a focused on the "search" and not on the "search and compare", could have sense to have a checkbox like "show search result on separate tab", that when enabled the search works as now, when disable only latest search with same search criteria are shown ?

Quote
The "Search again" in Paolo's popup menu is good. Even better would be to have it in the tab itself, in addition to the TreeView under the tab.
this part of my code seems working correctly (I'll post the code asap), but according to your objection the result of "search again" should be on a separate tab or override the current one ? my view it was an override (essentially it was a refresh after changes in the code, if any), but according to your suggestions it should be shown on another tab for possible comparison, right ?

thanks for any comments.

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: Search again
« Reply #34 on: October 17, 2020, 05:02:07 pm »
What about if we put both (see image)

refesh update (the current tab is override by new results)
search again (results shown on separate tab)

 :D


Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Search again
« Reply #35 on: October 17, 2020, 05:21:48 pm »
I was a focused on the "search" and not on the "search and compare", could have sense to have a checkbox like "show search result on separate tab", that when enabled the search works as now, when disable only latest search with same search criteria are shown ?

See my previous comments, yes such a checkbox would help. 

I will see and get some feedback from the rest of the team, as to were it should/could go.


Quote
but according to your objection the result of "search again" should be on a separate tab or override the current one ? my view it was an override (essentially it was a refresh after changes in the code, if any), but according to your suggestions it should be shown on another tab for possible comparison, right ?

"search again" (maybe better named "refresh"/"refresh search" or "update search result"  should replace the existing *tab*.
That is: The "tab" from which it was started.
Therefore:
- IF "update search result" searches with the given setting (without showing a dialoge to change those settings), then the "tab from which it started" is the tab with the same settings.
  BUT: there may be multiple tabs with those exact same settings (if I intentionally did several such searches before).
  So the tab must be stored when the user selects the menu-item (or button).
- IF "update search result" does show a dialoge, the user could change search settings => but it still replaces this tab. (because it is an "update")

Whereas a menu item "new search" could pre-fill the dialoge with the setting from the selected tab => but would not replace the tab.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Search again
« Reply #36 on: October 17, 2020, 05:49:25 pm »
What about if we put both (see image)
refesh update (the current tab is override by new results)
search again (results shown on separate tab)
Yes, Martin already suggested it. Then search again would open the search dialog with the same settings.

I was a focused on the "search" and not on the "search and compare", could have sense to have a checkbox like "show search result on separate tab", that when enabled the search works as now, when disable only latest search with same search criteria are shown ?
See my previous comments, yes such a checkbox would help. 
I will see and get some feedback from the rest of the team, as to were it should/could go.
I am against that. A local popup menu on a search result tab will affect the selected tab. It is super intuitive.
If the user wants a new search result tab, he does Ctrl-Shift-F. Again intuitive.
I don't know how you would improve the GUI by adding CheckBoxes around the IDE. There are too many of them already.
« Last Edit: October 17, 2020, 05:58:44 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Search again
« Reply #37 on: October 17, 2020, 05:54:11 pm »
Quote
It only compares the SearchText, not the other search criteria. A user would want to search from different directories, using case sensitive/insensitive, regular expression etc., and have their results in separate tabs
this is partially true, my code leaves separate tabs for example if you enabled or disable "case sensitive" option (see pdf figure (1)), but you are right, it does not recognize some other changed criteria like different path search, thanks to point out this.
Your function IfAlreadySearched in ide.patch does :
Code: Pascal  [Select][+][-]
  1.   if SearchObj.fSearchString = SearchText then begin
  2.     result:=(SearchObj.fSearchOptions = FindInFilesDialogSingleton.Options);
  3.   end;
Clearly it does not compare the "Case sensitive" option. Maybe you have a private patch that does it, but you forgot to upload it.

[Edit]
I realized the search results window already has a speedbutton (up/left) to start a new search. It then copies the search text to the "Find in Files" window. It works partially like the planned Search again feature, but it should copy all criteria in addition to the text.
The next button is Close current page. So, these buttons already work on the selected tab/page. We should add there a Refresh button to make it consistent and complete.
The Refresh and Search again should be in the popup menus as well. More choice is good.
« Last Edit: October 17, 2020, 07:13:32 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Search again
« Reply #38 on: October 17, 2020, 06:24:16 pm »
Better and more intuitive would be to support reordering the tabs by user. Is the current PageControl (or something?) easy to replace with the extended notebook? You have best knowledge of it.
Its a drop in replacement. Should be possible to use the object-inspectors "change class" feature.
It would then need to handle the OnTabDragDrop event (and maybe other OnTab.... events) to make sure the treeviews are correctly associated (not sure how much work is needed there).
I replaced it in r64038.
Wow, it was maybe the easiest change in Lazarus code so far. I only set properties TabDragMode and TabDragAcceptMode to dmAutomatic and it works. No event handling was needed.
Please test.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: Search again
« Reply #39 on: October 17, 2020, 07:48:48 pm »
Quote
Clearly it does not compare the "Case sensitive" option. Maybe you have a private patch that does it, but you forgot to upload it.

it does in the options comparison !
Code: Pascal  [Select][+][-]
  1. result:=(SearchObj.fSearchOptions = FindInFilesDialogSingleton.Options);
missed something?

a note : looking at the search results of some test cases I see (see code below and image) the "count" in the tab is (1), but it should be (2) [searched word is "aA" with no whole words option active]  is it a bug ? (LAZARUS 2.0.10, FPC 3.2.0)

Code: Pascal  [Select][+][-]
  1. procedure TForm1.Button1Click(Sender: TObject);
  2. var
  3.   aA, aaA : integer;
  4. begin
  5.  
  6. end;
  7.  

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Search again
« Reply #40 on: October 17, 2020, 07:56:26 pm »
I think it counts the lines.
But technically that is wrong, it should count matches. So that would be a bug IMHO.

However, if changed, it should NOT count overlapping matches.
Search (case insensitive) "abab" in the below.
Code: Pascal  [Select][+][-]
  1. abABabAb
Matches start at pos: 1, 3 (overlap), 5. But I think it should report 2. But I am open for other opinions.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 9791
  • Debugger - SynEdit - and more
    • wiki
Re: Search again
« Reply #41 on: October 17, 2020, 07:57:00 pm »
Wow, it was maybe the easiest change in Lazarus code so far. I only set properties TabDragMode and TabDragAcceptMode to dmAutomatic and it works. No event handling was needed.
Please test.
With ctrl key, it shows "copy" cursor.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Search again
« Reply #42 on: October 17, 2020, 09:39:00 pm »
it does in the options comparison !
Code: Pascal  [Select][+][-]
  1. result:=(SearchObj.fSearchOptions = FindInFilesDialogSingleton.Options);
missed something?
Yes, sorry! The Result was set there based on comparison. My bad.

I took the liberty to add a Refresh button there in r64042. It only shows a ToDo item in ShowMessage now. Please feel free to implement.
I still feel the same functionality should be replicating in a local popup menu. Many people prefer textual information over icons.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: Search again
« Reply #43 on: October 17, 2020, 11:39:00 pm »
With ctrl key, it shows "copy" cursor.
That is a small imperfection. For consistency it should copy the tab if Ctrl-Drag is the standard way to do it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

 

TinyPortal © 2005-2018