Fix mouse clicks on remote-open-folder UI (#19851)
Also change Zed's standard style to use `.track_focus(&self.focus_handle(cx))`, instead of `.track_focus(&self.focus_handle)`, to catch these kinds of errors more easily in the future. Release Notes: - N/A --------- Co-authored-by: Conrad <conrad@zed.dev>
This commit is contained in:
parent
826d83edfe
commit
80f89059aa
20 changed files with 28 additions and 28 deletions
|
@ -4707,7 +4707,7 @@ impl Render for ConfigurationView {
|
||||||
|
|
||||||
let mut element = v_flex()
|
let mut element = v_flex()
|
||||||
.id("assistant-configuration-view")
|
.id("assistant-configuration-view")
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
.size_full()
|
.size_full()
|
||||||
.overflow_y_scroll()
|
.overflow_y_scroll()
|
||||||
|
|
|
@ -2726,7 +2726,7 @@ impl Render for CollabPanel {
|
||||||
.on_action(cx.listener(CollabPanel::collapse_selected_channel))
|
.on_action(cx.listener(CollabPanel::collapse_selected_channel))
|
||||||
.on_action(cx.listener(CollabPanel::expand_selected_channel))
|
.on_action(cx.listener(CollabPanel::expand_selected_channel))
|
||||||
.on_action(cx.listener(CollabPanel::start_move_selected_channel))
|
.on_action(cx.listener(CollabPanel::start_move_selected_channel))
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.size_full()
|
.size_full()
|
||||||
.child(if self.user_store.read(cx).current_user().is_none() {
|
.child(if self.user_store.read(cx).current_user().is_none() {
|
||||||
self.render_signed_out(cx)
|
self.render_signed_out(cx)
|
||||||
|
|
|
@ -185,7 +185,7 @@ impl Render for CopilotCodeVerification {
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
.id("copilot code verification")
|
.id("copilot code verification")
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.elevation_3(cx)
|
.elevation_3(cx)
|
||||||
.w_96()
|
.w_96()
|
||||||
.items_center()
|
.items_center()
|
||||||
|
|
|
@ -101,7 +101,7 @@ impl Render for ProjectDiagnosticsEditor {
|
||||||
};
|
};
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.when(self.path_states.is_empty(), |el| {
|
.when(self.path_states.is_empty(), |el| {
|
||||||
el.key_context("EmptyPane")
|
el.key_context("EmptyPane")
|
||||||
})
|
})
|
||||||
|
|
|
@ -485,7 +485,7 @@ impl Render for TextInput {
|
||||||
div()
|
div()
|
||||||
.flex()
|
.flex()
|
||||||
.key_context("TextInput")
|
.key_context("TextInput")
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.cursor(CursorStyle::IBeam)
|
.cursor(CursorStyle::IBeam)
|
||||||
.on_action(cx.listener(Self::backspace))
|
.on_action(cx.listener(Self::backspace))
|
||||||
.on_action(cx.listener(Self::delete))
|
.on_action(cx.listener(Self::delete))
|
||||||
|
@ -549,7 +549,7 @@ impl Render for InputExample {
|
||||||
let num_keystrokes = self.recent_keystrokes.len();
|
let num_keystrokes = self.recent_keystrokes.len();
|
||||||
div()
|
div()
|
||||||
.bg(rgb(0xaaaaaa))
|
.bg(rgb(0xaaaaaa))
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.flex()
|
.flex()
|
||||||
.flex_col()
|
.flex_col()
|
||||||
.size_full()
|
.size_full()
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
/// impl Render for Editor {
|
/// impl Render for Editor {
|
||||||
/// fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
/// fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
/// div()
|
/// div()
|
||||||
/// .track_focus(&self.focus_handle)
|
/// .track_focus(&self.focus_handle(cx))
|
||||||
/// .keymap_context("Editor")
|
/// .keymap_context("Editor")
|
||||||
/// .on_action(cx.listener(Editor::undo))
|
/// .on_action(cx.listener(Editor::undo))
|
||||||
/// .on_action(cx.listener(Editor::redo))
|
/// .on_action(cx.listener(Editor::redo))
|
||||||
|
|
|
@ -271,7 +271,7 @@ impl Render for ImageView {
|
||||||
.left_0();
|
.left_0();
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.size_full()
|
.size_full()
|
||||||
.child(checkered_background)
|
.child(checkered_background)
|
||||||
.child(
|
.child(
|
||||||
|
|
|
@ -479,7 +479,7 @@ impl Render for MarkdownPreviewView {
|
||||||
v_flex()
|
v_flex()
|
||||||
.id("MarkdownPreview")
|
.id("MarkdownPreview")
|
||||||
.key_context("MarkdownPreview")
|
.key_context("MarkdownPreview")
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.size_full()
|
.size_full()
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
.p_4()
|
.p_4()
|
||||||
|
|
|
@ -3787,7 +3787,7 @@ impl Render for OutlinePanel {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.track_focus(&self.focus_handle);
|
.track_focus(&self.focus_handle(cx));
|
||||||
|
|
||||||
if self.cached_entries.is_empty() {
|
if self.cached_entries.is_empty() {
|
||||||
let header = if self.updating_fs_entries {
|
let header = if self.updating_fs_entries {
|
||||||
|
|
|
@ -52,8 +52,8 @@ impl EmptyHead {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for EmptyHead {
|
impl Render for EmptyHead {
|
||||||
fn render(&mut self, _: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
div().track_focus(&self.focus_handle)
|
div().track_focus(&self.focus_handle(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3136,7 +3136,7 @@ impl Render for ProjectPanel {
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.child(
|
.child(
|
||||||
uniform_list(cx.view().clone(), "entries", item_count, {
|
uniform_list(cx.view().clone(), "entries", item_count, {
|
||||||
|this, range, cx| {
|
|this, range, cx| {
|
||||||
|
@ -3268,7 +3268,7 @@ impl Render for ProjectPanel {
|
||||||
.id("empty-project_panel")
|
.id("empty-project_panel")
|
||||||
.size_full()
|
.size_full()
|
||||||
.p_4()
|
.p_4()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.child(
|
.child(
|
||||||
Button::new("open_project", "Open a project")
|
Button::new("open_project", "Open a project")
|
||||||
.full_width()
|
.full_width()
|
||||||
|
|
|
@ -149,7 +149,7 @@ impl Render for DisconnectedOverlay {
|
||||||
};
|
};
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.elevation_3(cx)
|
.elevation_3(cx)
|
||||||
.on_action(cx.listener(Self::cancel))
|
.on_action(cx.listener(Self::cancel))
|
||||||
.occlude()
|
.occlude()
|
||||||
|
|
|
@ -1266,7 +1266,7 @@ impl Render for RemoteServerProjects {
|
||||||
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
self.selectable_items.reset();
|
self.selectable_items.reset();
|
||||||
div()
|
div()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.elevation_3(cx)
|
.elevation_3(cx)
|
||||||
.w(rems(34.))
|
.w(rems(34.))
|
||||||
.key_context("RemoteServerModal")
|
.key_context("RemoteServerModal")
|
||||||
|
|
|
@ -327,7 +327,7 @@ impl Render for ProjectSearchView {
|
||||||
div()
|
div()
|
||||||
.flex_1()
|
.flex_1()
|
||||||
.size_full()
|
.size_full()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.child(self.results_editor.clone())
|
.child(self.results_editor.clone())
|
||||||
} else {
|
} else {
|
||||||
let model = self.model.read(cx);
|
let model = self.model.read(cx);
|
||||||
|
@ -365,7 +365,7 @@ impl Render for ProjectSearchView {
|
||||||
.size_full()
|
.size_full()
|
||||||
.justify_center()
|
.justify_center()
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.child(
|
.child(
|
||||||
h_flex()
|
h_flex()
|
||||||
.size_full()
|
.size_full()
|
||||||
|
|
|
@ -975,7 +975,7 @@ impl Render for TerminalView {
|
||||||
div()
|
div()
|
||||||
.size_full()
|
.size_full()
|
||||||
.relative()
|
.relative()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.key_context(self.dispatch_context(cx))
|
.key_context(self.dispatch_context(cx))
|
||||||
.on_action(cx.listener(TerminalView::send_text))
|
.on_action(cx.listener(TerminalView::send_text))
|
||||||
.on_action(cx.listener(TerminalView::send_keystroke))
|
.on_action(cx.listener(TerminalView::send_keystroke))
|
||||||
|
|
|
@ -348,7 +348,7 @@ impl Render for ContextMenu {
|
||||||
.min_w(px(200.))
|
.min_w(px(200.))
|
||||||
.max_h(vh(0.75, cx))
|
.max_h(vh(0.75, cx))
|
||||||
.overflow_y_scroll()
|
.overflow_y_scroll()
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.on_mouse_down_out(cx.listener(|this, _, cx| this.cancel(&menu::Cancel, cx)))
|
.on_mouse_down_out(cx.listener(|this, _, cx| this.cancel(&menu::Cancel, cx)))
|
||||||
.key_context("menu")
|
.key_context("menu")
|
||||||
.on_action(cx.listener(ContextMenu::select_first))
|
.on_action(cx.listener(ContextMenu::select_first))
|
||||||
|
|
|
@ -72,7 +72,7 @@ impl Render for WelcomePage {
|
||||||
h_flex()
|
h_flex()
|
||||||
.size_full()
|
.size_full()
|
||||||
.bg(cx.theme().colors().editor_background)
|
.bg(cx.theme().colors().editor_background)
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.child(
|
.child(
|
||||||
v_flex()
|
v_flex()
|
||||||
.w_80()
|
.w_80()
|
||||||
|
|
|
@ -658,7 +658,7 @@ impl Render for Dock {
|
||||||
|
|
||||||
div()
|
div()
|
||||||
.key_context(dispatch_context)
|
.key_context(dispatch_context)
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.flex()
|
.flex()
|
||||||
.bg(cx.theme().colors().panel_background)
|
.bg(cx.theme().colors().panel_background)
|
||||||
.border_color(cx.theme().colors().border)
|
.border_color(cx.theme().colors().border)
|
||||||
|
@ -689,7 +689,7 @@ impl Render for Dock {
|
||||||
} else {
|
} else {
|
||||||
div()
|
div()
|
||||||
.key_context(dispatch_context)
|
.key_context(dispatch_context)
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -826,8 +826,8 @@ pub mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for TestPanel {
|
impl Render for TestPanel {
|
||||||
fn render(&mut self, _cx: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
div().id("test").track_focus(&self.focus_handle)
|
div().id("test").track_focus(&self.focus_handle(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1173,8 +1173,8 @@ pub mod test {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Render for TestItem {
|
impl Render for TestItem {
|
||||||
fn render(&mut self, _: &mut ViewContext<Self>) -> impl IntoElement {
|
fn render(&mut self, cx: &mut ViewContext<Self>) -> impl IntoElement {
|
||||||
gpui::div().track_focus(&self.focus_handle)
|
gpui::div().track_focus(&self.focus_handle(cx))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2574,7 +2574,7 @@ impl Render for Pane {
|
||||||
|
|
||||||
v_flex()
|
v_flex()
|
||||||
.key_context(key_context)
|
.key_context(key_context)
|
||||||
.track_focus(&self.focus_handle)
|
.track_focus(&self.focus_handle(cx))
|
||||||
.size_full()
|
.size_full()
|
||||||
.flex_none()
|
.flex_none()
|
||||||
.overflow_hidden()
|
.overflow_hidden()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue