mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-10 20:41:59 +00:00
Block extra drag events in original drag handlers
This commit is contained in:
parent
ee66f99ce6
commit
354c020612
4 changed files with 16 additions and 1 deletions
|
@ -172,6 +172,10 @@ impl EditorElement {
|
||||||
.on_drag(MouseButton::Left, {
|
.on_drag(MouseButton::Left, {
|
||||||
let position_map = position_map.clone();
|
let position_map = position_map.clone();
|
||||||
move |event, editor, cx| {
|
move |event, editor, cx| {
|
||||||
|
if event.end {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if !Self::mouse_dragged(
|
if !Self::mouse_dragged(
|
||||||
editor,
|
editor,
|
||||||
event.platform_event,
|
event.platform_event,
|
||||||
|
@ -1235,6 +1239,10 @@ impl EditorElement {
|
||||||
})
|
})
|
||||||
.on_drag(MouseButton::Left, {
|
.on_drag(MouseButton::Left, {
|
||||||
move |event, editor: &mut Editor, cx| {
|
move |event, editor: &mut Editor, cx| {
|
||||||
|
if event.end {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let y = event.prev_mouse_position.y();
|
let y = event.prev_mouse_position.y();
|
||||||
let new_y = event.position.y();
|
let new_y = event.position.y();
|
||||||
if thumb_top < y && y < thumb_bottom {
|
if thumb_top < y && y < thumb_bottom {
|
||||||
|
|
|
@ -147,6 +147,9 @@ impl<V: View> Element<V> for Resizable<V> {
|
||||||
let max_size = side.relevant_component(constraint.max);
|
let max_size = side.relevant_component(constraint.max);
|
||||||
let on_resize = self.on_resize.clone();
|
let on_resize = self.on_resize.clone();
|
||||||
move |event, view: &mut V, cx| {
|
move |event, view: &mut V, cx| {
|
||||||
|
if event.end {
|
||||||
|
return;
|
||||||
|
}
|
||||||
let new_size = min_size
|
let new_size = min_size
|
||||||
.max(prev_size + side.compute_delta(event))
|
.max(prev_size + side.compute_delta(event))
|
||||||
.min(max_size)
|
.min(max_size)
|
||||||
|
|
|
@ -78,7 +78,7 @@ lazy_static! {
|
||||||
// * use more strict regex for `file://` protocol matching: original regex has `file:` inside, but we want to avoid matching `some::file::module` strings.
|
// * use more strict regex for `file://` protocol matching: original regex has `file:` inside, but we want to avoid matching `some::file::module` strings.
|
||||||
static ref URL_REGEX: RegexSearch = RegexSearch::new(r#"(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file://|git://|ssh:|ftp://)[^\u{0000}-\u{001F}\u{007F}-\u{009F}<>"\s{-}\^⟨⟩`]+"#).unwrap();
|
static ref URL_REGEX: RegexSearch = RegexSearch::new(r#"(ipfs:|ipns:|magnet:|mailto:|gemini://|gopher://|https://|http://|news:|file://|git://|ssh:|ftp://)[^\u{0000}-\u{001F}\u{007F}-\u{009F}<>"\s{-}\^⟨⟩`]+"#).unwrap();
|
||||||
|
|
||||||
static ref WORD_REGEX: RegexSearch = RegexSearch::new("[\\w.:/@-~]+").unwrap();
|
static ref WORD_REGEX: RegexSearch = RegexSearch::new(r#"[\w.:/@\-~]+"#).unwrap();
|
||||||
}
|
}
|
||||||
|
|
||||||
///Upward flowing events, for changing the title and such
|
///Upward flowing events, for changing the title and such
|
||||||
|
|
|
@ -411,6 +411,10 @@ impl TerminalElement {
|
||||||
})
|
})
|
||||||
// Update drag selections
|
// Update drag selections
|
||||||
.on_drag(MouseButton::Left, move |event, _: &mut TerminalView, cx| {
|
.on_drag(MouseButton::Left, move |event, _: &mut TerminalView, cx| {
|
||||||
|
if event.end {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if cx.is_self_focused() {
|
if cx.is_self_focused() {
|
||||||
if let Some(conn_handle) = connection.upgrade(cx) {
|
if let Some(conn_handle) = connection.upgrade(cx) {
|
||||||
conn_handle.update(cx, |terminal, cx| {
|
conn_handle.update(cx, |terminal, cx| {
|
||||||
|
|
Loading…
Reference in a new issue