1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-11 13:51:01 -05:00

Fix bracketed paste with EOT payload

This works around an issue in many (all?) shells where the bracketed
paste logic would only strip out `\r` but interpret EOT (`\x03`) as a
termination of the bracketed paste.
This commit is contained in:
Christian Duerr 2023-02-23 19:57:18 +01:00 committed by GitHub
parent 79ea8b9482
commit f01dea8643
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View file

@ -47,6 +47,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Redraw hanging until a keypress on X11 in rare cases - Redraw hanging until a keypress on X11 in rare cases
- Window clipping when maximizing a window without decorations on Windows - Window clipping when maximizing a window without decorations on Windows
- Quadrants not aligned with half blocks with built-in font - Quadrants not aligned with half blocks with built-in font
- EOT (`\x03`) escaping bracketed paste mode
### Removed ### Removed

View file

@ -790,7 +790,15 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext<T> for ActionCon
} }
} else if self.terminal().mode().contains(TermMode::BRACKETED_PASTE) { } else if self.terminal().mode().contains(TermMode::BRACKETED_PASTE) {
self.write_to_pty(&b"\x1b[200~"[..]); self.write_to_pty(&b"\x1b[200~"[..]);
self.write_to_pty(text.replace('\x1b', "").into_bytes());
// Write filtered escape sequences.
//
// We remove `\x1b` to ensure it's impossible for the pasted text to write the bracketed
// paste end escape `\x1b[201~` and `\x03` since some shells incorrectly terminate
// bracketed paste on its receival.
let filtered = text.replace('\x1b', "").replace('\x03', "");
self.write_to_pty(filtered.into_bytes());
self.write_to_pty(&b"\x1b[201~"[..]); self.write_to_pty(&b"\x1b[201~"[..]);
} else { } else {
// In non-bracketed (ie: normal) mode, terminal applications cannot distinguish // In non-bracketed (ie: normal) mode, terminal applications cannot distinguish