diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b82d1c9..7d19290e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 - Window clipping when maximizing a window without decorations on Windows - Quadrants not aligned with half blocks with built-in font +- EOT (`\x03`) escaping bracketed paste mode ### Removed diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 5eafc09c..3ecca5e8 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -790,7 +790,15 @@ impl<'a, N: Notify + 'a, T: EventListener> input::ActionContext for ActionCon } } else if self.terminal().mode().contains(TermMode::BRACKETED_PASTE) { 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~"[..]); } else { // In non-bracketed (ie: normal) mode, terminal applications cannot distinguish