@@ -15,6 +15,7 @@ use std::{
15
15
time:: Duration ,
16
16
} ;
17
17
18
+ use crossterm:: event:: KeyEventKind ;
18
19
use crossterm:: {
19
20
event:: { poll, read, Event , KeyCode , KeyEvent , KeyModifiers } ,
20
21
terminal:: { disable_raw_mode, enable_raw_mode} ,
@@ -116,20 +117,22 @@ pub fn monitor(
116
117
117
118
if interactive_mode && poll ( Duration :: from_secs ( 0 ) ) . into_diagnostic ( ) ? {
118
119
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
+ _ => { }
125
129
}
126
- _ => { }
127
130
}
128
- }
129
131
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
+ }
133
136
}
134
137
}
135
138
}
0 commit comments