Skip to content

Conversation

@jmacdonald
Copy link
Owner

Amp integrates with the system clipboard, writing content to it when copying, and reading content from it when pasting. This works well most of the time, but there are situations (e.g. using Amp remotely over SSH) where this fails.

The fallback in these scenarios is to paste content via stdin. However, Amp needs to be aware of this to avoid applying things like indentation on newlines. This PR introduces a new "paste" mode that takes pasted input literally, avoiding those problems.

Additionally, Amp's input handling has been updated to eagerly read all input when it receives a ready event on stdin. Previously, it would only read the next character, and would wait for another ready event before reading more. With edge triggered events, pending data won't trigger another event unless new data arrives. Since pasting involves a lot of input at once, this situation became commonplace, necessitating a fix.

@jmacdonald jmacdonald self-assigned this Oct 13, 2025
Replace Termion stdin key iterator with non-blocking alternative

Refactor system clipboard comparison/update logic

Try to reclaim system clipboard if setting contents fails
@jmacdonald jmacdonald merged commit cb3b258 into main Oct 17, 2025
1 check passed
@jmacdonald jmacdonald deleted the paste branch October 17, 2025 03:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants