Author Topic: F7/F8 dialog history ...  (Read 4046 times)

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
F7/F8 dialog history ...
« on: April 11, 2018, 06:33:58 PM »
When I open big find I hit F7 and F8 to recall previous and next settings.
Assume that the history items are numbered 0 to N, where 0 is the newest and N is the oldest.
(0 isn't really in history yet - it is the current state of the dialog).

BUT:
Open Find and you are history item 0
Hit F7: You are at history item 2
Hit F8: You are at history item 1

There is no way to navigate directly to history item 1.

This is really awkward of course -- I'd like a more direct way to open find and have it populated with history item 1.



Repro steps:
  • gui-find: Search for ABC
  • gui-find: Search for DEF
  • find-file: Search for some file c:\src, *.cpp
  • Select a bit of text.
  • gui-find
  • The bigfind dialog opens with the search text populated with the selected text.
  • Press F8: Nothing happens (we stay at item 0)
  • press F7: BigFind now has search text DEF (item 2)
  • press F8: BigFind is now on the Files tab (item 1)

And Item 0, searching for the selected text, is now gone - not remembered.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: F7/F8 dialog history ...
« Reply #1 on: April 12, 2018, 11:00:35 PM »
This has been an annoyance for a long time.  Good job reporting it.

There's room at the bottom of the dialog to say
Quote
Press F7, F8 to step thru search history.
Right click for more options.

I suspect most people don't know about these.

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: F7/F8 dialog history ...
« Reply #2 on: April 13, 2018, 04:31:35 AM »
Like this?
Just adding that text and the dialog code is smart enough to make room for it -- I didn't have to touch the code at all.
« Last Edit: April 13, 2018, 04:35:43 AM by jporkkahtc »

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: F7/F8 dialog history ...
« Reply #3 on: April 13, 2018, 12:46:24 PM »
The part where it skips over item 1 to item 2 when you initially use F7, that is a bug very specific to the Find & Replace tool window, I am looking into workarounds for that one.  Most other forms with dialog history should work as expected.  I'll have to think about whether it is worth the effort to save/restore the initialized state of the tool window (item 0) when you start using dialog history.  The Find & Replace tool window is one of more complex forms, it can be initialized in very different state than it previously used depending on which command you use to bring it up.  Saving the initialized state to history might add more noise than you really want.

Marcel

  • Senior Community Member
  • Posts: 261
  • Hero Points: 26
Re: F7/F8 dialog history ...
« Reply #4 on: April 13, 2018, 03:18:12 PM »
My 2 cents:
  • Have a separate history for [find] and [find/replace].  The current history feature presents some real Frankenstein entries when you use F/FR interleaved. Very easy to pick the wrong entry if you don't look closely.
  • Provide the history in list form so that I can scroll through and pick what I need.  I sometimes create very laborious F/R regexes and would like to find them again a month later.  It his much simpler to pick them from a list than F7'ing through them.
  • Provide a much longer history. I know there is a variable somewhere, but who remembers what it is.  Put the history size on the dialog

Marcel

jporkkahtc

  • Senior Community Member
  • Posts: 2620
  • Hero Points: 210
  • Text
Re: F7/F8 dialog history ...
« Reply #5 on: April 13, 2018, 03:22:50 PM »
Yeah, I get that - this is a really complex dialog.
(Despite the complexity, I think it is the best find/replace tool I've ever used)

Separate histories for each tab: Thats a pretty good idea, but doesn't solve the Item 0 problem entirely.
History List: See the DIFFZilla setup dialog - This is an oddball dialog with the "Sessions" list. Seems to duplicate F7/F8 functionality (which also works here).
History size: yes!

WRT item 0: Never save it to history - that would be wrong.
If you do this it would be a special case just for Find.
Save the initial state in a global.
If F8 is pressed while at the top of history, restore from that global.

I don't know how history works, but I assume there must be an index variable that tracks where you are in history?
Setting that index variable to a special value (-1 ?) on entry to find, then F7 can check for that.

Lee

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1299
  • Hero Points: 130
Re: F7/F8 dialog history ...
« Reply #6 on: April 13, 2018, 04:09:48 PM »
There is a def-var for dialog history size, def_maxdialoghist, and the default is 10.   It's not currently listed in Options, but you can use set-var on the SlickEdit command-line (or Macro > Set Macro Variable) to change.  It is a global setting, there isn't a way to override history size per form, but something we could definitely think about for the future.  (On a related note, see def_maxcombohist specifically for Combo box controls history for the drop-down).  YMMV.

Separate history per tab?  Interesting idea, especially for this form.  That could be a possibility in a future build.

There is a feature to save and restore searches, useful for "bookmarking" searches that you might use infrequently with complex setups or gnarly regexes you don't want type again.  Saved Search Expressions menu is available on tool window on the right-click context menu, and on the menu drop-down in Mini-Find.  From that sub-menu, you can save all current options using the Save Search Expression, and recall them later as needed.

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: F7/F8 dialog history ...
« Reply #7 on: April 14, 2018, 09:39:53 AM »
Here's an interesting search to save. It finds global variables that start with def_ and are int, bool or _str.  Slick finds 988 of them in 155 files out of 748  - the help has 488. (For some reason it finds 1014 if I allow leading spaces "^ @int def_|^ @bool def_|^ @_str def_" - but the output has no leading spaces that I can see).

Are the un-commented ones (such as def_maxdialoghist) not intended for end users  - they don't show up in the help - or maybe they're accessible in the options gui.  Maybe the help could have all the def vars and their description all on one page so that you could use the page search (ctrl F) to look for something and F3 to repeat, if it's easy to do.  Or make a pdf of them all.


Code: [Select]
_command last_recorded_macro() name_info(','VSARG2_MARK|VSARG2_REQUIRES_EDITORCTL)
{
   _macro('R',1);
   clear_highlights();
   clear_highlights();
   _mffind2("^int def_|^bool def_|^_str def_","RI",'+t C:\Program Files\SlickEdit\V22.0.2\macros',"*.e;*.sh",'',"64",'3');
}

Edit : found some leading spaces  -  I used minifind to look for them and it had reg expr. enabled and I didn't notice.
« Last Edit: April 14, 2018, 09:48:34 AM by Graeme »

Graeme

  • Senior Community Member
  • Posts: 2793
  • Hero Points: 347
Re: F7/F8 dialog history ...
« Reply #8 on: April 15, 2018, 04:32:56 AM »
I just realized you can use the search tool "lines before/ lines after" values to get some context with each def_var.