@@ -927,25 +927,35 @@ impl MainWindow {
927927 if poll ( Duration :: from_millis ( self . config . poll_rate ) ) ? {
928928 match read ( ) ? {
929929 Event :: Key ( input) => {
930- // Die on Ctrl-C
931- if input == exit_key {
932- self . quit ( ) ?;
933- return Ok ( ( ) ) ;
934- }
935-
936- // Otherwise, match input to action
937- match self . input_type {
938- InputType :: Normal => normal_handler. receive_input ( self , input. code ) ?,
939- InputType :: Command => {
940- command_handler. receive_input ( self , input. code ) ?;
930+ // Only trigger on key presses, per https://github.com/ReagentX/Logria/issues/134
931+ // See also https://github.com/crossterm-rs/crossterm/issues/752
932+ if input. is_press ( ) {
933+ // Die on Ctrl-C
934+ if input == exit_key {
935+ self . quit ( ) ?;
936+ return Ok ( ( ) ) ;
941937 }
942- InputType :: Regex => regex_handler. receive_input ( self , input. code ) ?,
943- InputType :: Parser => parser_handler. receive_input ( self , input. code ) ?,
944- InputType :: Startup => {
945- startup_handler. receive_input ( self , input. code ) ?;
946- }
947- InputType :: Highlight => {
948- highlight_handler. receive_input ( self , input. code ) ?;
938+
939+ // Otherwise, match input to action
940+ match self . input_type {
941+ InputType :: Normal => {
942+ normal_handler. receive_input ( self , input. code ) ?
943+ }
944+ InputType :: Command => {
945+ command_handler. receive_input ( self , input. code ) ?;
946+ }
947+ InputType :: Regex => {
948+ regex_handler. receive_input ( self , input. code ) ?
949+ }
950+ InputType :: Parser => {
951+ parser_handler. receive_input ( self , input. code ) ?
952+ }
953+ InputType :: Startup => {
954+ startup_handler. receive_input ( self , input. code ) ?;
955+ }
956+ InputType :: Highlight => {
957+ highlight_handler. receive_input ( self , input. code ) ?;
958+ }
949959 }
950960 }
951961 }
0 commit comments