zyedidia / micro

A modern and intuitive terminal-based text editor
https://micro-editor.github.io
MIT License
25.05k stars 1.17k forks source link

OSC52 incorrect sequence sent for Kitty's clear-clipboard extension #1855

Closed dnkl closed 4 years ago

dnkl commented 4 years ago

Description of the problem or steps to reproduce

It appears micro tries to send Kitty's clear-clipboard extension command, before sending clipboard data.

The sequence sent is slightly wrong however. The specification says to send an invalid payload and uses \e]52;c;!\e\\ as an example. Micro is sending \e]52;c!\e\\ - i.e. there's a ; missing. This means micro isn't sending an invalid payload, it is sending an invalid selection parameter.

Specifications

Commit hash: f35f5078 OS: Linux Terminal: foot

zyedidia commented 4 years ago

Thanks, this has been fixed!

dnkl commented 4 years ago

Thanks!

Still not quiiite right though... suggested change:

--- tscreen.go.orig     2020-09-06 08:22:29.603752924 +0200
+++ tscreen.go  2020-09-06 08:22:41.340333274 +0200
@@ -45,7 +45,7 @@ const (

        pasteSet   = "\x1b]52;%c;%s\a"
        pasteGet   = "\x1b]52;%c;?\a"
-       pasteClear = "\x1b]52;%c!;\a"
+       pasteClear = "\x1b]52;%c;!\a"

        pasteOSC52Begin = "\x1b]52;"
        pasteOSC52End   = "\x1b\\"

(on a side note: while \a is likely to work in most terminals, the correct terminator is ST, i.e \x1b\\. This is documented in ECMA-48, 8.3.89, OSC - Operating System Command)

zyedidia commented 4 years ago

Oh haha thanks I clearly didn't read your message closely enough. I'll fix this along with the byte by byte reading shortly.

dnkl commented 4 years ago

Verified. Thanks!