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

If had a previous OSC-52 (paste) in MOSH and there’s a disconnect, blink does a spurious paste #1205

Closed
2 tasks done
idvorkin opened this issue Feb 21, 2021 · 9 comments
Closed
2 tasks done
Labels
bug Bug that's either related to Blink Shell or prevents the user to use the app in normal conditions.

Comments

@idvorkin
Copy link

Checklist

Configuration

13.5.11.261

Describe the bug

If you did an OSC-52 (paste) in MOSH and there’s a disconnect, blink does a spurious paste. This can repro if you close/open blink (and I suspect if Blink was idle for a few minutes).

This is painful as it clears the system clipboard.

@idvorkin idvorkin added the support Help needed from the maintainers of the repository label Feb 21, 2021
@idvorkin idvorkin changed the title If doing OSC-52 (paste) in MOSH and there’s a disconnect, blink does a spurious paste If had a previous OSC-52 (paste) in MOSH and there’s a disconnect, blink does a spurious paste Feb 21, 2021
@idvorkin
Copy link
Author

idvorkin commented May 5, 2021

Ping

@idvorkin
Copy link
Author

idvorkin commented Jan 1, 2023

@carloscabanero - Any ETAs here? Anything I can do to help diagnose?

@carloscabanero
Copy link
Member

Hi! So we have been discussing this one thoroughly over Discord (specially @rrgeorge). The problem is not what the issue is, but what the proper solution should look like. Mosh in this scenario is behaving the way it should.

One idea is to create a special mode where we identify when this situation may happen, and then try to skip certain sequences at the terminal level. This may even require a buffer due to the nature of OSC-52 so not easy, specially because we can only touch the client.

Another suggestion from @rrgeorge himself over Discord was to assign a special clipboard to the terminal, and use that as an exchange instead of the system clipboard:

I just had an idea, and I was wondering what the blink devs thought of it. When using OSC-52 over mosh, it creates a problem where every time the session is loaded, (changing tabs, return to blink, etc) the system clipboard is overwritten with whatever osc-52 was last sent from that session. It could be new, or it could be super old. It’s such a nuisance that I stopped using osc-52 in my sessions. But it’s such a useful thing if it worked in a more user friendly way. So onto my idea:
Instead of immediately losing and osc-52 sequence into the system clipboard, have a “terminal clipboard” unique to that terminal that can be displayed with keyboard shortcut that you can manually copy from. You can further that with having the contents auto selected, so you could do some thing like:
Cmd+C -> Display Clipboard, Cmd+C (again) copy it to the system clipboard

@idvorkin
Copy link
Author

Happy to hop on discord. Can you tag me on the relevant threads.

@idvorkin
Copy link
Author

Slightly related, I've been using a pipe to pbcopy/pbpaste solution on my Mac for similar use cases:

See #1672

@carloscabanero
Copy link
Member

Another thing we are testing atm is to skip OSC52 after reconnection from our side, at least for a few seconds. Because we are the ones triggering the reconnection step, we may be able to control this sequence better at that stage. We need to check if this is possible.

@carloscabanero carloscabanero added bug Bug that's either related to Blink Shell or prevents the user to use the app in normal conditions. and removed support Help needed from the maintainers of the repository labels May 15, 2023
@carloscabanero
Copy link
Member

Alright, so we have a fix for this, but it comes with a small quirk (which is actually Mosh'). This happens in the desktop as well, you can try it out.

Mosh holds its own state of the clipboard, so even if that changes outside, copying the same sequence won't trigger it again. Ie. if you copy on Mosh, then copy somewhere else, and then copy the same sequence on Mosh, the last copy won't happen. This is because Mosh still thinks it has the proper Clipboard state, so it does not try to overwrite it.

I think this is a small quirk and probably no one will notice, but mentioning here so everyone can give their take.

For future reference, I think the only approach that may solve this is to actually have a different "Clipboard" for the terminal, as that could follow the state as-is. We are still figuring out what the mechanics for that would be, but definitely interesting.

@idvorkin
Copy link
Author

idvorkin commented May 20, 2023 via email

@carloscabanero
Copy link
Member

This is now out on 16.1.8!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that's either related to Blink Shell or prevents the user to use the app in normal conditions.
Projects
None yet
Development

No branches or pull requests

2 participants