Add support for direct paste #308
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.