This commit is contained in:
Austin Schey 2025-02-04 21:37:16 -08:00 committed by GitHub
parent e063091312
commit 2c18768d2c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,7 +5,10 @@
use std::io;
use crossterm::{event::{self, Event, KeyCode, KeyEvent, KeyEventKind}, terminal};
use crossterm::{
event::{self, Event, KeyCode, KeyEvent, KeyEventKind},
terminal,
};
pub fn read_char() -> io::Result<char> {
loop {
@ -23,11 +26,12 @@ pub fn read_char() -> io::Result<char> {
pub fn read_line() -> io::Result<String> {
let mut line = String::new();
loop {
if let Event::Key(KeyEvent{
if let Event::Key(KeyEvent {
code,
kind: KeyEventKind::Press,
..
}) = event::read()? {
}) = event::read()?
{
match code {
KeyCode::Enter => {
break;