Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

save search query, and restore on cmd-K #897

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Feb 22, 2024

as I'm working on a project with ~300 pages, I find that not having this feature is very annoying, since when I'm working on "calendar" (say…), I have to re-type the same search query again and again (I'll test a bit with the feature on, I hope that it's not annoying in a different way :-) )

  • Almost perfect, but I need to normalize paths so that e.g. /maplibre-gl#12/47.27574/11.39085/0/52 matches /maplibre-gl

closes #889

store-search-query.mp4

Fil added a commit to Fil/pangea that referenced this pull request Feb 25, 2024
@Fil Fil requested a review from mbostock February 27, 2024 21:31
@Fil
Copy link
Contributor Author

Fil commented Feb 27, 2024

It can be live-tested on the "pangea" project.

@mbostock
Copy link
Member

mbostock commented Mar 2, 2024

What if…

  • We keep a recent history of searches (captured either on clearing the search field by clicking the x or hitting Esc, or by navigating to a result)
  • When the search box is empty, the up arrow would restore the most-recent search result and select all the text of the search query
  • When the search query is selected in its entirety (and non-empty), the up and down arrow would navigate the search history, changing the query (instead of navigating within the search results)
  • When the search query is selected in its entirety, hitting Enter would unselect the text and put the caret to the end of the search query, allowing you to either edit the query or hit Enter again to select the top result

I think it’s a good idea to have a way to restore previous queries. I just want it to be accessible through clicking rather than only Command-K, and I want it to be a bit more of a deliberate action than changing the normal behavior.

@Fil
Copy link
Contributor Author

Fil commented Mar 2, 2024

The current PR is not just restoring the previous query (only one in this PR), it's also positioning the cursor to the current page (if it's one of the search results), so you can iterate through the list with one arrowDown. I'm not sure if what you suggest would be as convenient for this use case, but the only way to know is to try. (And I'm not sure if this use case is that important… it's just what I've been optimizing for as I was working on porting dozens of notebooks.)

In any case I fully agree that it should work on focus, rather than only on cmd-K. (DONE)

@Fil
Copy link
Contributor Author

Fil commented Mar 12, 2024

This PR works as before, but on focus; it only remembers/restores the previous query, but requires a small number of actions from the user. I'm exploring the alternative UI in #1044.

@Fil
Copy link
Contributor Author

Fil commented Apr 29, 2024

rebased

@Fil Fil force-pushed the fil/save-search-query branch 2 times, most recently from 1acff79 to 29af671 Compare September 2, 2024 08:50
@Fil Fil force-pushed the fil/save-search-query branch 2 times, most recently from fbf2e2b to 9280b35 Compare October 1, 2024 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

remember previous search query
2 participants