modal prefix searching in REPL

From the discussions in #6377, #8577, and #8468, it is clear that we need a better solution for the interaction between prefix history searching and multi-line history entries. This PR implements one such solution which is a modal prefix searching behavior. The idea is that pressing up/down arrow will start a prefix search, and then will *continue* to do prefix searching on subsequent presses until some key other than up/down is pressed. In this way, history searching is not "interrupted" by multi-line history entries. It also allows us to put the cursor at the end of the line, like the old history traversal behavior (i.e. this fixes #8577).

Reasons that this is WIP:

~~1) I seem to have re-broken down-arrow behavior in terms of continuing from a previously accepted history item. i.e. #8468 is back with this PR.~~
~~2) I need to figure out how to 'forward' a keypress to the parent REPL mode. At present, except for the arrow keys, enter/return, and ctrl+C, all other keys simply exit prefix searching mode without performing any other action. I am exploring alternatives to simply pulling in all the key bindings from the default keymap.~~
~~3) I need to rebase into a smaller number of commits.~~