File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -20,18 +20,23 @@ fn get_input() -> String {
2020 noecho ( ) ;
2121
2222 /* Prompt for a character. */
23- printw ( "Please enter your diff (ENTER / ESC once done):\n " ) ;
23+ printw ( "Please enter your diff, must start with double quotes (ENTER / ESC once done):\n " ) ;
2424 let mut input = String :: new ( ) ;
25+ let mut started = false ;
2526 loop {
2627 let ch = getch ( ) ;
27- // Return if ENTER or ESC
28- if ch == 10 || ch == 27 {
29- refresh ( ) ;
30- break ;
31- } else {
32- let c = char:: from_u32 ( ch as u32 ) . expect ( "Invalid char" ) ;
33- printw ( & format ! ( "{}" , c) ) ;
34- input. push ( c) ;
28+ match ch {
29+ 10 | 27 => break , // Return if ENTER or ESC
30+ _ => {
31+ let c = char:: from_u32 ( ch as u32 ) . expect ( "Invalid char" ) ;
32+ if started || c == '"' {
33+ printw ( & format ! ( "{}" , c) ) ;
34+ input. push ( c) ;
35+ if !started {
36+ started = true ;
37+ }
38+ }
39+ }
3540 }
3641 refresh ( ) ;
3742 }
You can’t perform that action at this time.
0 commit comments