mirror of
https://github.com/wez/wezterm.git
synced 2024-11-23 15:04:36 +03:00
x11: speculatively allow pasting latin-1 data
refs: https://github.com/wez/wezterm/issues/4402
This commit is contained in:
parent
925568a215
commit
46732d049a
@ -169,6 +169,8 @@ As features stabilize some brief notes about them will accumulate here.
|
||||
to a cache invalidation issue. #4828
|
||||
* X11: Fix an issue where SHIFT and other modifiers could be inaccurate for automated
|
||||
or high speed keyboard inputs. #4615 #3840
|
||||
* X11: can now paste STRING (latin-1) data from the clipboard, in addition to
|
||||
UTF-8 string data. #4402
|
||||
|
||||
#### Updated
|
||||
* Bundled harfbuzz to 8.3.0
|
||||
|
@ -881,6 +881,40 @@ impl XWindowInner {
|
||||
log::error!("clipboard: err while getting clipboard property: {:?}", err);
|
||||
}
|
||||
}
|
||||
} else if selection.property() != xcb::x::ATOM_NONE
|
||||
&& selection.target() == xcb::x::ATOM_STRING
|
||||
{
|
||||
log::trace!(
|
||||
"SEL: window_id={window_id:?} requesting selection from window {:?}",
|
||||
selection.requestor()
|
||||
);
|
||||
|
||||
match conn.send_and_wait_request(&xcb::x::GetProperty {
|
||||
delete: false,
|
||||
window: selection.requestor(),
|
||||
property: selection.property(),
|
||||
r#type: xcb::x::ATOM_STRING,
|
||||
long_offset: 0,
|
||||
long_length: u32::max_value(),
|
||||
}) {
|
||||
Ok(prop) => {
|
||||
if let Some(mut promise) = self.copy_and_paste.request_mut(clipboard).take()
|
||||
{
|
||||
fn latin1_to_string(s: &[u8]) -> String {
|
||||
s.iter().map(|&c| c as char).collect()
|
||||
}
|
||||
|
||||
promise.ok(latin1_to_string(prop.value()));
|
||||
}
|
||||
conn.send_request_no_reply(&xcb::x::DeleteProperty {
|
||||
window: self.window_id,
|
||||
property: conn.atom_xsel_data,
|
||||
})?;
|
||||
}
|
||||
Err(err) => {
|
||||
log::error!("clipboard: err while getting clipboard property: {:?}", err);
|
||||
}
|
||||
}
|
||||
} else if let Some(mut promise) = self.copy_and_paste.request_mut(clipboard).take() {
|
||||
log::trace!(
|
||||
"SEL: window_id={window_id:?} weird state, fulfil promise with empty string"
|
||||
|
Loading…
Reference in New Issue
Block a user