Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add escape for reading clipboard #2966

Merged
merged 2 commits into from Nov 11, 2019

Conversation

chrisduerr
Copy link
Member

No description provided.

@kchibisov
Copy link
Member

Are we trying to follow what xterm does or we'd have our own approach on handling this?

Just reading through xterm spec https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands . It seems it's a bit more tricky then just check first char of 1 parameter.

The first, Pc, may contain zero or more characters from the set c , p , q , s , 0 , 1 , 2 , 3 , 4 , 5 , 6 , and 7.

@chrisduerr
Copy link
Member Author

It seems it's a bit more tricky then just check first char of 1 parameter.

That's correct, however I don't think we need to support the full spec. Our clipboard library doesn't even support all these different buffers, so there's no way we could support them. So we just support the part of the spec that is most likely to be used.

So we do p/s => selection clipboard and c => clipboard. The rest q/0-7 we can't support with our clipboard library, so we just throw it away.

I think that's a reasonable minimal implementation to follow and I don't expect that we really need to support any more than this. Considering how most terminal emulators (like VTE and URxvt) don't support this at all and even XTerm requires configuration to support setting the clipboard data.

@kchibisov
Copy link
Member

I'm not worry about supporting full spec, I worry about your p,s,c parameters being missed, due to things like 0pc, since the spec isn't clear here. Am I correct that it shouldn't happen?

@chrisduerr
Copy link
Member Author

I'm not worry about supporting full spec, I worry about your p,s,c parameters being missed, due to things like 0pc, since the spec isn't clear here. Am I correct that it shouldn't happen?

Honestly I don't 100% know myself how the other buffers work, but 0c as a parameter in the second position does not work with xterm. My assumption is that the buffers are set using q0 - q7 as second parameter and p c s are only valid on their own.

So I think we should be good the way we're doing it here. We're not supporting q and the multiple buffers, but that's just a completely missing feature, but everything else involving the clipboards we support ourselves seems to work exactly as it does in XTerm.

If you want to test it yourself and find anything else, please let me know. But I think our behavior should be correct for the things we do support.

@kchibisov
Copy link
Member

Honestly I don't 100% know myself how the other buffers work, but 0c as a parameter in the second position does not work with xterm.

That's what I'd like to hear. I was wondering whether I can write to Selection and Clipboard, by sending just one escape, since xterm spec says, you can pass more then one char, but doesn't emphasize that p,c,s should be used on their own.

So, looks good to me.

@chrisduerr chrisduerr merged commit e8ca1ef into alacritty:master Nov 11, 2019
@chrisduerr chrisduerr deleted the read-clipboard-escape branch November 11, 2019 00:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants