File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -410,8 +410,14 @@ fn main() {
410410 if editing {
411411 ui. edit_field ( todo, & mut editing_cursor, x / 2 ) ;
412412
413- if let Some ( '\n' ) = ui. key . take ( ) . map ( |x| x as u8 as char ) {
414- editing = false ;
413+ match ui. key . take ( ) . map ( |x| x as u8 as char ) {
414+ Some ( '\n' ) => editing = false ,
415+ Some ( '\u{1b}' ) => {
416+ editing = false ;
417+ list_delete ( & mut todos, & mut todo_curr) ;
418+ break ;
419+ }
420+ _ => { }
415421 }
416422 } else {
417423 ui. label_fixed_width (
@@ -483,7 +489,9 @@ fn main() {
483489 if editing {
484490 ui. edit_field ( done, & mut editing_cursor, x / 2 ) ;
485491
486- if let Some ( '\n' ) = ui. key . take ( ) . map ( |x| x as u8 as char ) {
492+ if let Some ( '\n' ) | Some ( '\u{1b}' ) =
493+ ui. key . take ( ) . map ( |x| x as u8 as char )
494+ {
487495 editing = false ;
488496 }
489497 } else {
You can’t perform that action at this time.
0 commit comments