Disallow OSC 52 for unfocused window

This leads to issues on macOS, since if we store clipboard at the same
time it could error out. Also, on e.g. Wayland the clipboard store for
unfocused window won't work anyway.
This commit is contained in:
Kirill Chibisov 2022-04-03 23:08:44 +03:00 committed by GitHub
parent 49d64fbeec
commit 851dbc328e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
### Changed
- The `--help` output was reworked with a new colorful syntax
- OSC 52 is now disabled on unfocused windows
### Fixed

View File

@ -1078,11 +1078,15 @@ impl input::Processor<EventProxy, ActionContext<'_, Notifier, EventProxy>> {
}
},
TerminalEvent::ClipboardStore(clipboard_type, content) => {
self.ctx.clipboard.store(clipboard_type, content);
if self.ctx.terminal.is_focused {
self.ctx.clipboard.store(clipboard_type, content);
}
},
TerminalEvent::ClipboardLoad(clipboard_type, format) => {
let text = format(self.ctx.clipboard.load(clipboard_type).as_str());
self.ctx.write_to_pty(text.into_bytes());
if self.ctx.terminal.is_focused {
let text = format(self.ctx.clipboard.load(clipboard_type).as_str());
self.ctx.write_to_pty(text.into_bytes());
}
},
TerminalEvent::ColorRequest(index, format) => {
let color = self.ctx.terminal().colors()[index]