benjaminor / kkp

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

Bracketed paste not working #7

Closed dnkl closed 1 year ago

dnkl commented 1 year ago

Using the terminal to paste (with bracketed paste enabled) doesn't quite work. It inserts È (codepoint 200) before the pasted text, and É (codepoint 201) after the pasted text.

I see that you've been doing some work on this as well (https://github.com/benjaminor/kkp/commit/98e13a22921e4d270e363fadb67a0aafc779d8ed), but that's unfortunately not enough to get it working for me.

I started to look at this myself, but have so far only gotten to:

diff --git a/kkp.el b/kkp.el
index 621d314..7e8d8d2 100644
--- a/kkp.el
+++ b/kkp.el
@@ -392,7 +392,7 @@ key codepoint."
     (cond

      ;; this protocol covers all keys with a prefix in `kkp--key-prefixes' except for this external one
-     ((equal terminal-input "200~")
+     ((equal (concat terminal-input) "200~")
       #'xterm-translate-bracketed-paste)

      ;; input has this form: keycode[:[shifted-key][:base-layout-key]];[modifiers[:event-type]][;text-as-codepoints]{u~}

This at least makes it match the opening paste sequence, something it didn't do before.

I thought I'd open issue now, before I spend too much time on something that may be obvious to you, or maybe something you're already working on.

dnkl commented 1 year ago

Note that this isn't a huge issue for me; I normally paste with OSC-52. In other words, this is low priority for me.

benjaminor commented 1 year ago

You're right. I actually never used or tested it before. Calling the function was incorrect but should be fixed now with the latest commit.

dnkl commented 1 year ago

Thanks, it does indeed work now :)