Closed yangyingchao closed 9 months ago
Hi, thanks for reporting this.
C-q
calls quoted-insert
in Emacs, which is used to insert an input character. This uses internally read-char
to read the character input event, without any translation by the input translation maps which kkp
uses. This is why you get the 'pure' event sent by the terminal.
An alternative would be to use a custom quoted-insert
function which relies on read-key
and not on read-char
. This way, we can still translate the input event:
(defun my-quoted-insert-with-read-key (arg)
"Insert the next character using read-key, not read-char."
(interactive "*p")
(let ((char (read-key)))
;; Ensure char is treated as a character code for insertion
(unless (characterp char)
(user-error "%s is not a valid character"
(key-description (vector char))))
(when (numberp char)
(while (> arg 0)
(insert-and-inherit char)
(setq arg (1- arg))))))
Then, bind C-q
to my-quoted-insert-with-read-key
and you should be good to go.
thanks :)
Thanks for providing this package; it's really helpful: now I can remove tricky CSI configurations in kitty & foot.
However, I've encountered an issue with the keys that start with
C-q
. For example, in both kitty & foot terminal:C-q C-j
should insert a newline without any indent, but instead, it inserts^[[106;5u]
.C-q C-M
should produce the special character^M
, but it actually gives^[[109;5u]
.Can you please provide some suggestions on this?