diff options
author | Rory Dudley | 2024-09-30 21:55:32 -0600 |
---|---|---|
committer | Rory Dudley | 2024-09-30 23:01:41 -0600 |
commit | 350be1b8869ce9d3a572348104c30f804d44641e (patch) | |
tree | 75c68761ccd21a3395609f0fb1e2e0a440b441c8 /Cargo.toml | |
parent | 243a8c53ae03713b3d6b4f5bf82859f9c93be6ed (diff) | |
download | dwarvish-350be1b8869ce9d3a572348104c30f804d44641e.tar.gz |
Replace io::stdin().read_line() with custom function
Added the termios crate to facilitate the changing of certain terminal
options. It is a wrapper around the termios C library, so 'man 3
termios' for more details.
Added the custom getchar() function, with retrieves characters from
STDIN as they are typed by the user (as opposed to waiting for a
newline, like io::stdin().read_line()). This is necessary, since keys
like <tab> and <up> have special functionality, which needs to be acted
on before command submission.
Added the custom getline() function, which uses getchar() to read
characters as they are typed. The getline() function contains the logic
for the various key presses. For most characters, we simply push the
byte to a buffer, and print it out to the screen (since getline()
assumes ECHO is off).
Signed-off-by: Rory Dudley <rory@netc.lu>
Diffstat (limited to 'Cargo.toml')
-rw-r--r-- | Cargo.toml | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -15,3 +15,4 @@ path = "src/main.rs" [dependencies] libc = "0.2.153" signal-hook = "0.3.17" +termios = "0.3.3" |