RFC: Track and make use of consecutive keystrokes in the REPL

This PR enables the tracking of repeated consecutive keystrokes, and uses it in four places:

1. This supersedes the REPL's own counting of consecutive returns to abort an incomplete AST entry within its on_enter done-check with a more general implementation.  The on_enter functionality is very minutely different -- instead of checking for three consecutive newlines, this checks for three consecutive keystrokes that call the return callback (so, e.g., alternating between `^J` and return won't trigger this).  But for nearly all use-cases this behaves the same.
2. When the same keystroke is used to repeatedly call edit_kill (^K), the killed text is appended to the buffer instead of replacing it.
3. For tab completions, instead of the current complete-or-show-possible-completions behavior, this now requires a second consecutive tab press to show the possible completions. This behaves a little bit more like most shells, and prevents excessive printing of options in most cases.  I had thought that this would be necessary to incrementally complete the latex symbol names, but it turns out that it doesn't really require counting consecutive tabs and is orthogonal to this change, so I have split it out and will submit it separately.
4. In move_line_start/end (^A/^E), jump to the start/end of input upon a repeated keystroke instead of detecting that the cursor is already at the beginning or end of a line. This way the behavior changes based purely upon the input instead of relying on where the cursor happens to be.

Overall, this simplifies some logic (in 1 & 4) while allowing for more complex behaviors.

cc: @loladiro