@@ -15,6 +15,7 @@ use std::{
1515 time:: Duration ,
1616} ;
1717
18+ use crossterm:: event:: KeyEventKind ;
1819use crossterm:: {
1920 event:: { poll, read, Event , KeyCode , KeyEvent , KeyModifiers } ,
2021 terminal:: { disable_raw_mode, enable_raw_mode} ,
@@ -116,20 +117,22 @@ pub fn monitor(
116117
117118 if interactive_mode && poll ( Duration :: from_secs ( 0 ) ) . into_diagnostic ( ) ? {
118119 if let Event :: Key ( key) = read ( ) . into_diagnostic ( ) ? {
119- if key. modifiers . contains ( KeyModifiers :: CONTROL ) {
120- match key. code {
121- KeyCode :: Char ( 'c' ) => break ,
122- KeyCode :: Char ( 'r' ) => {
123- reset_after_flash ( & mut serial, pid) . into_diagnostic ( ) ?;
124- continue ;
120+ if key. kind == KeyEventKind :: Press {
121+ if key. modifiers . contains ( KeyModifiers :: CONTROL ) {
122+ match key. code {
123+ KeyCode :: Char ( 'c' ) => break ,
124+ KeyCode :: Char ( 'r' ) => {
125+ reset_after_flash ( & mut serial, pid) . into_diagnostic ( ) ?;
126+ continue ;
127+ }
128+ _ => { }
125129 }
126- _ => { }
127130 }
128- }
129131
130- if let Some ( bytes) = handle_key_event ( key) {
131- serial. write_all ( & bytes) . into_diagnostic ( ) ?;
132- serial. flush ( ) . into_diagnostic ( ) ?;
132+ if let Some ( bytes) = handle_key_event ( key) {
133+ serial. write_all ( & bytes) . into_diagnostic ( ) ?;
134+ serial. flush ( ) . into_diagnostic ( ) ?;
135+ }
133136 }
134137 }
135138 }
0 commit comments