-
Notifications
You must be signed in to change notification settings - Fork 30.6k
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
Built-in linux terminal crashes when pasting 39-character string into nano #180257
Comments
I can confirm this issue on Windows using WSL. |
It happens with other 39 long strings as well. It also happens when not using WSL. Copying more characters solves the problem. |
When trace logs are enabled this is the exact sequence we send:
Compared to 1 less
Note that the 200/201 wrapped around it is bracketed paste mode (which I just added a way to disable so that may help #189480). So this seems to be either a problem with one of nano, conpty or node-pty. |
I also just ran into this. I'm on Windows 10, using Remote - SSH plugin to connect to an Ubuntu 22.04 server. Right-click to paste in Nano, terminal locks up, have to Kill it. Add/remove one character from the string and try again, works. |
We closed this issue because we don't plan to address it in the foreseeable future. If you disagree and feel that this issue is crucial: we are happy to listen and to reconsider. If you wonder what we are up to, please see our roadmap and issue reporting guidelines. Thanks for your understanding, and happy coding! |
i opened a bug on gnu nano's bugtracker: https://savannah.gnu.org/bugs/index.php?64996 |
I think I found a workaround, but haven't tested it: vscode intentionally splits terminal writes into at most 50-byte chunks, nano doesn't deal well with escape sequences being split across writes and it is apparently difficult to fix in nano. vscode could split writes differently, using this algorithm that keeps escape sequences at the beginning and end unsplit (like bracketed pastes): const num_chunks = Math.ceil(data.length / Constants.WriteMaxChunkSize);
if (num_chunks == 1) {
write(data);
} else if (num_chunks == 2) {
const split_point = Math.floor(data.length / 2);
write(data.substr(0, split_point));
write(data.substr(split_point));
} else if (num_chunks > 2) {
const stop = data.length - Constants.WriteMaxChunkSize;
for (let i = 0; i < stop; i += Constants.WriteMaxChunkSize) {
const size = Math.min(stop - i, Constants.WriteMaxChunkSize);
write(data.substr(i, size));
}
write(data.substr(stop));
} |
@programmerjake great info, we should definitely do this 👍. I'll probably tweak your proposal a little to try catch escape sequences in the middle too. |
I don't expect input sizes to be > 50 bytes except when pasting, when pasting there should only ever be an escape sequence at the beginning and end, never in the middle (terminal apps are unlikely to deal well with pasting a string containing escape sequences anyway). |
@programmerjake unless I missed something in the issue you linked, it's not that they need to be on the boundaries of the text but need to be included entirely in that string and not clipped? |
yes, escape sequences need to be contained entirely in one write syscall. basically I am saying you shouldn't have escape sequences in the middle of a long input, so you don't need to look for them to avoid splitting them, they should only occur towards the ends of a long input or in a shorter input. |
Nano's workaround was released in Nano 8.0: https://savannah.gnu.org/bugs/?64996#comment14 |
Does this issue occur when all extensions are disabled?: Yes
Steps to Reproduce:
nano
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
More details:
The text was updated successfully, but these errors were encountered: