skipped 789 lines 790 790 } 791 791 } else if self.terminal().mode().contains(TermMode::BRACKETED_PASTE) { 792 792 self.write_to_pty(&b"\x1b[200~"[..]); 793 - self.write_to_pty(text.replace('\x1b', "").into_bytes()); 793 + 794 + // Write filtered escape sequences. 795 + // 796 + // We remove `\x1b` to ensure it's impossible for the pasted text to write the bracketed 797 + // paste end escape `\x1b[201~` and `\x03` since some shells incorrectly terminate 798 + // bracketed paste on its receival. 799 + let filtered = text.replace('\x1b', "").replace('\x03', ""); 800 + self.write_to_pty(filtered.into_bytes()); 801 + 794 802 self.write_to_pty(&b"\x1b[201~"[..]); 795 803 } else { 796 804 // In non-bracketed (ie: normal) mode, terminal applications cannot distinguish skipped 906 lines