* Extract history management into struct
* Encapsulates the up/down arrow browsing
* Still fully in-memory but easy to add file based constructors and
flushing
* No further integration with the statefulness of the Ctrl-R search
(yet)
* Add tests to history
* Basic clear
Addresses #28
Succeeds in providing a clear new screen for both the line editing and
reverse search mode.
Solution is conservative and prints more newlines than strictly
necessary as solutions with scrolling didn't seem to work as expected.
* Command based clear
* Redraw prompt indicator after history search
The prompt indicator gets drawn over when searching the history so we
need to restore it when done searching.
Co-authored-by: Jason Rodney Hansen <jasonrodneyhansen@gmail.com>
* Minimal enum to address #18
Reuse outer Result for error handling only pass the special case
signals.
* Restore behavior of shell
* support exit via `exit` or `logout`
* Clear buffer on pressing Ctrl-c
* move one line down on Ctrl-c
* Handling by main maybe suboptimal
* Fix whitespace awareness regression
* Rename special Ctrl key signals
Removed need to collect grapheme indices into a Vec. Also, we can slice
the buffer from or to the insertion point to not have to iterate through
all of the indices.
* Use Unicode words for movement
This also skips multiple consecutive non-word characters (word boundaries) as part of the movement in a similar way to how bash/readline do it.
* Simplify logic
* Fix off by one slicing issue and simplify logic further
With this patch, if you hold ALT (or Option on Mac) and then
press Arrow Left or Arrow Right, the cursor will jump over the
whole word instead of just one character to allow for more
natural text editing.