Repository navigation
Send a paste to the PTY in one write - #797
Merged
Merged
Conversation
The start bracket, text and end bracket were separate writes. A terminal bridged through ghostel-pty-out-function can add a round trip between them, and zsh ends a paste at any gap longer than KEYTIMEOUT and runs the pasted lines.
paste-ghostel.json pastes into bash, zsh, fish, nu and the python3 REPL, on the native and the Emacs PTY, and checks with the shell's own output that nothing runs before RET. It covers multi-line, large, multibyte, control-byte, embedded end-bracket, tab and CRLF pastes, a program without bracketed paste, and every paste entry point.
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
A paste went out as three writes: start bracket, text, end bracket. A terminal bridged through
ghostel-pty-out-functioncan add a round trip between them. zsh ends a paste at any gap longer thanKEYTIMEOUT(0.4s by default) and runs the pasted lines.encodePastenow joins the frame and text into one buffer, so the hook gets a single call. Theghostel-pty-out-functiondocstring states that a paste must arrive without a pause.Effect on bridged terminals
terminal.write.send-keyschunk. Larger pastes are still split there, with a round trip between chunks.Testing
make -j8 allpasses, withLIBRARY_PATHset for a localemutls_wlink problem.ghostel-test-paste-is-one-pty-writecovers bracketed, unbracketed and empty pastes.zsh-pasteelate group (0.6s write delay, zsh 5.9): passes with this change. On 0.62.0 it fails: two of the three pasted lines ran before RET, and the last line got a stray~from the late end bracket.