vsc-cnst / SublimeTextFileFilter

Sublime Text plugin for filtering file content using regular expressions
MIT License
5 stars 1 forks source link

Features: text history and regex toggles #6

Open reagle opened 2 weeks ago

reagle commented 2 weeks ago

Two features following #5. It'd be nice to have:

  1. The ability to cursor up/down through a history of previous expressions.
  2. The ability to toggle regex, case, whole word, wrap, etc. just like the ST search/replace functionality.

I wonder if plugins can actually borrow the functionality of the built-in regex modal? (Plus, the syntax would be PCRE and be more consistent.)

vsc-cnst commented 2 weeks ago

It is my understanding that sublime gives little or no control over editor interfaces - not sure a arrow up/down is possible. The same goes to nr 2. it is not possible to have a more complex panel like ST search, with additional buttons

I do have in backlog some features that might help

  1. Filter from selection
  2. Add current filter to quick panel

Given your input it would me possible to add a 'quick panel' like feature with history.

TerminalFi commented 2 weeks ago

There are a few ways to go about #.2

  1. List input handler could be used to first add or remove toggles for regex. Then call the text input handler. I actually do this in a private plugin for piping text to shell commands. And support CLI flags.
  2. Just support additional / optional flags in the command, then those could be pass along to the input handler which is then used to preview the current options.

Modifier keys might also come in handy

reagle commented 2 weeks ago

On the discord channel for package-development, @OdatNurd said:

That's possible, yes. Well, assuming it's using an input panel at the bottom of the screen anyway. I have never used it myself But, the input panel is a distinct view, which means you can apply a setting to it, which means that the plug-in author can define key bindings that apply only while it has the focus, which means it could catch pushing up and down arrow keys and swapping through the history of previously used filters If it was taking the regex input via the command palette, then that's trickier because you can have either a list or text, but not both.