benjaminor / kkp

Emacs support for the Kitty Keyboard Protocol
GNU General Public License v3.0
32 stars 6 forks source link

Issues with the delete key #6

Closed dnkl closed 1 year ago

dnkl commented 1 year ago

I'm having issues getting the Delete key to work correctly. It seems that by default, with kkp (verified with emacs -q), it maps to DEL, which usually maps to backwards deletion instead of forward deletion.

I'm currently working around it with

(define-key (current-global-map) (kbd "<delete>") 'delete-forward-char)

but it feels both ugly and incorrect (modes often map it to variants of delete-forward...)

The behavior is the same in both foot-1.15.1 and kitty-0.28.1. Using kkp https://github.com/benjaminor/kkp/commit/5652ba0bfa7a4c03daffc301c9ca4a9899c4f440)

dnkl commented 1 year ago

I suspect kp-delete has the same problem

benjaminor commented 1 year ago

Hi, thanks very much for reporting this!

Emacs provides a mode normal-erase-is-backspace-mode, which tries to remap delete and kp-delete via the local-function-key-map to delete forward when turned on.

This still allows global and local maps to remap delete and kp-delete if they wish so.

I have now tried in a separate branch (https://github.com/benjaminor/kkp/tree/handle-delete-keys) to turn normal-erase-is-backspace-mode on when KKP is enabled. This should solve your issue, could you verify this?

dnkl commented 1 year ago

Unfortunately it does not. The behavior remains exactly the same, as far as I can see.

Furthermore, toggling (normal-erase-is-backspace) again, makes backspace delete forward, while Delete still deletes backwards.

dnkl commented 1 year ago

No, that's wrong. It does work. I had an older version of kkp in my load path 😅.

Sorry about that!