summaryrefslogtreecommitdiffstats
path: root/src/buffer.rs
Commit message (Collapse)AuthorAgeFilesLines
* Replace io::stdin().read_line() with custom functionRory Dudley2024-09-301-0/+59
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>