jtroo / kanata

Improve keyboard comfort and usability with advanced customization
GNU Lesser General Public License v3.0
3.08k stars 129 forks source link

Bug: chordsv2 out of order key handling #1232

Closed kkard2 closed 2 months ago

kkard2 commented 2 months ago

Requirements

Describe the bug

characters are handled only after partial chord being released, which results in out of order text. attached config with unreasonable 1500 value for testing.

Relevant kanata config

(defcfg
  concurrent-tap-hold yes
)

(defsrc a s)

(deflayer default a s)

(defchordsv2-experimental
  (a s) (macro h e l l o spc w o r l d) 1500 all-released ()
)

To Reproduce

  1. press down a
  2. press down l
  3. release a

Expected behavior

"al" (which is the behavior without kanata) instead of "la"

Kanata version

kanata 1.7.0-prerelease-1 (7adab8a)

Debug logs

No response

Operating system

Linux (X11)

Additional context

i tried a couple of values as timeout in my config, and found 75 to be the shortest acceptable value. this does not seem to result with out of order letters, but in my native language which is polish we use altgr for special characters. i find myself losing them all the time, because of muscle memory keys are pressed in the following order:

  1. altgr key down
  2. a key down
  3. altgr key up
  4. a key up & b key down (in whichever order)

this results in "ab" instead of "ąb".

i would personally like chords to write text as you go, and delete it if it's necessary, to have an immediate feedback (this is more of a feature request than fix to this problem), but even if that's not possible this issue should be somehow fixed

jtroo commented 2 months ago

You should either put l in defsrc (alongside all other relevant keys) or use process-unmapped-keys yes in defcfg to have Kanata process event order correctly.

kkard2 commented 2 months ago

you are correct, this solves the "bug" in "To Reproduce" section. issue still persists with altgr. there is a workaround of using a custom altgr layer, but it would be annoying to set up (using unicode for every character). you would probably also need a separate altgr+shift layer?

jtroo commented 2 months ago

Can you see if latest main https://github.com/jtroo/kanata/commit/a0f1b892657a340dc10a5c65a03ddaa37af0392f fixes the altgr issue?

kkard2 commented 2 months ago

yes, it's fixed