PaulJuliusMartinez / jless

jless is a command-line JSON viewer designed for reading, exploring, and searching through JSON data.
https://jless.io
MIT License
4.61k stars 87 forks source link

Search improvements #132

Open Delicious-Bacon opened 9 months ago

Delicious-Bacon commented 9 months ago

Search history

At the moment, typing anything into a search and pressing enter will locate the results, but if we want to modify the search term we have to open a new search and retype everything. It can get annoying when we use complex regex patterns and miss a character or forget to escape something.

Can we implement the search history that both vi and vim usually have?

For example, I forget to escape [] in /"name": "[bch]at" and then instead of retyping the whole pattern, I could just reopen the search with / and press ARROW UP key to use the previous search.

vi also lets me use the q/ command to select among the previous search terms.

Field search editable

Pressing either * or # enters the object field search, which is handy, but it's always just the field name and we can't edit the search terms we seek in that field.

If it were possible, it would speed up the search of "[bch]at" in the "name" field from the previous example by entering the field, pressing * and just adding the regex pattern before confirming the search.

Cancel search

We cannot cancel the search - once we enter the search with, for example, /, we need to search for something because that / is not erasable. An ESC key could be handy to cancel the search.

nkh commented 8 months ago

Same problem with search history for me.