A search specification

A search specification

Seaching in a document cmd+f has been a surprisingly hard feature to get right in the Debugger. On the surface, it seems like it should be simple, but there are a lot of subtle interactions that make it difficult to get right. Here is a quick spec that helped me document the feature.
Queries
  • typing/deleting query
    • should search after each character, index
    • the index and count should be correct
    • the match should be to right of the cursor
Iterating
  • (enter/shift enter | cmd+g/cmd+shift+g)
    • increments and decrements by one
    • wraps from first to last of the list and vice versa
  • moving the cursor
    • updates the match and index to be to the right of the cursor
Mouse Actions
  • click on document
    • cmd+g should research from that location.
    • cmd+f should refocus the search bar with the current query
    • search bar should search from the cursor location
  • select text
    • cmd+f should update the query of the search bar
    • cmd+g should search from that location with the current query