SlickEdit Community

SlickEdit Product Discussion => SlickEdit® => Features and/or Improvements => Topic started by: jporkkahtc on April 11, 2018, 06:33:58 pm

Title: F7/F8 dialog history ...
Post by: jporkkahtc 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:

And Item 0, searching for the selected text, is now gone - not remembered.
Title: Re: F7/F8 dialog history ...
Post by: Graeme 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.
Title: Re: F7/F8 dialog history ...
Post by: jporkkahtc 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.
Title: Re: F7/F8 dialog history ...
Post by: Lee 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.
Title: Re: F7/F8 dialog history ...
Post by: Marcel on April 13, 2018, 03:18:12 pm
My 2 cents:

Marcel
Title: Re: F7/F8 dialog history ...
Post by: jporkkahtc 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.
Title: Re: F7/F8 dialog history ...
Post by: Lee 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.
Title: Re: F7/F8 dialog history ...
Post by: Graeme 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.
Title: Re: F7/F8 dialog history ...
Post by: Graeme 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.