Restore paste on middle-click on linux (#18503)
This is a partial revert of e6c1c51b37
, which removed the middle-click
pasting on linux (both x11 & wayland). It also restores the
`middle_click_paste` option behavior which became unexistent.
Release Notes:
- Restore Linux middle-click pasting.
This commit is contained in:
parent
1f72069b42
commit
707ccb04d2
1 changed files with 24 additions and 5 deletions
|
@ -636,11 +636,30 @@ impl EditorElement {
|
||||||
cx.stop_propagation();
|
cx.stop_propagation();
|
||||||
} else if end_selection && pending_nonempty_selections {
|
} else if end_selection && pending_nonempty_selections {
|
||||||
cx.stop_propagation();
|
cx.stop_propagation();
|
||||||
} else if cfg!(target_os = "linux")
|
} else if cfg!(target_os = "linux") && event.button == MouseButton::Middle {
|
||||||
&& event.button == MouseButton::Middle
|
if !text_hitbox.is_hovered(cx) || editor.read_only(cx) {
|
||||||
&& (!text_hitbox.is_hovered(cx) || editor.read_only(cx))
|
return;
|
||||||
{
|
}
|
||||||
return;
|
|
||||||
|
#[cfg(target_os = "linux")]
|
||||||
|
if EditorSettings::get_global(cx).middle_click_paste {
|
||||||
|
if let Some(text) = cx.read_from_primary().and_then(|item| item.text()) {
|
||||||
|
let point_for_position =
|
||||||
|
position_map.point_for_position(text_hitbox.bounds, event.position);
|
||||||
|
let position = point_for_position.previous_valid;
|
||||||
|
|
||||||
|
editor.select(
|
||||||
|
SelectPhase::Begin {
|
||||||
|
position,
|
||||||
|
add: false,
|
||||||
|
click_count: 1,
|
||||||
|
},
|
||||||
|
cx,
|
||||||
|
);
|
||||||
|
editor.insert(&text, cx);
|
||||||
|
}
|
||||||
|
cx.stop_propagation()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue