From 53e1ddd2fb3e2143457d2fa6decb95f59c3979b8 Mon Sep 17 00:00:00 2001 From: Jan Tache Date: Sat, 4 Nov 2023 13:57:18 -0700 Subject: [PATCH] fix!(seq): release keys in valid visible-backspaced sequence --- src/kanata/mod.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/kanata/mod.rs b/src/kanata/mod.rs index 624d12634..5c5f10a73 100644 --- a/src/kanata/mod.rs +++ b/src/kanata/mod.rs @@ -863,6 +863,18 @@ impl Kanata { SequenceInputMode::HiddenSuppressed | SequenceInputMode::HiddenDelayType => {} SequenceInputMode::VisibleBackspaced => { + // Release all keys since they might modify the behaviour of + // backspace into an undesirable behaviour, for example deleting + // more characters than it should. + layout.states.retain(|s| match s { + State::NormalKey { keycode, .. } => { + // Ignore the error, ugly to return it from retain, and + // this is very unlikely to happen anyway. + let _ = self.kbd_out.release_key(keycode.into()); + false + } + _ => true, + }); for k in state.sequence.iter() { // Check for pressed modifiers and don't input backspaces for // those since they don't output characters that can be