diff options
author | Rory Dudley | 2024-09-30 21:55:34 -0600 |
---|---|---|
committer | Rory Dudley | 2024-09-30 23:01:48 -0600 |
commit | 9f5512442177b1242e40c25c14b0ae5d8e6f5359 (patch) | |
tree | 5a87e33e0cbbf6b051e1c1001f88838d0a3615b9 /Cargo.toml | |
parent | c51ad81d3cf5998e9eacf655a704ff21d154ae0a (diff) | |
download | dwarvish-9f5512442177b1242e40c25c14b0ae5d8e6f5359.tar.gz |
Slight refactor of getchar() and more handling for getline()
The getchar() function was changed so that it is able to detect some
ANSI escape sequences. To better handle this, getchar() now returns a
value from the Key enum, indicating whether or not an escape sequence
was found. Currently, the only escape sequences the function deals with
are arrow keys.
Handling of the left and right arrow keys were added to the getline()
function, in order to allow a user to go back and edit their command
inplace. Up and down arrow keys are also handled, but they are just
ignored for now (i.e. they do not move the cursor around anymore). The
local 'pos' variable became an Arc<Mutex<usize>>, since it needs to be
reset to 0 if ctrl-c is pressed (the handler for which is outside the
scope of getline()).
Signed-off-by: Rory Dudley <rory@netc.lu>
Diffstat (limited to 'Cargo.toml')
0 files changed, 0 insertions, 0 deletions