editor: allow specifying the initial text and and direction for search.

This can then be used by features like # in VIM to jump backwards in
the buffer immediately.