Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
agent_ui: Fix scrolling in context server configuration modal (#42502)
R.Amoghb9ce52dc9569
diff --git a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rsindex 88896f51086..ed1e8afd1b3 100644--- a/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs+++ b/crates/agent_ui/src/agent_configuration/configure_context_server_modal.rs@@ -7,8 +7,8 @@ use anyhow::{Context as _, Result};use context_server::{ContextServerCommand, ContextServerId};use editor::{Editor, EditorElement, EditorStyle};use gpui::{- AsyncWindowContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, Task,- TextStyle, TextStyleRefinement, UnderlineStyle, WeakEntity, prelude::*,+ AsyncWindowContext, DismissEvent, Entity, EventEmitter, FocusHandle, Focusable, ScrollHandle,+ Task, TextStyle, TextStyleRefinement, UnderlineStyle, WeakEntity, prelude::*,};use language::{Language, LanguageRegistry};use markdown::{Markdown, MarkdownElement, MarkdownStyle};@@ -23,7 +23,8 @@ use project::{use settings::{Settings as _, update_settings_file};use theme::ThemeSettings;use ui::{- CommonAnimationExt, KeyBinding, Modal, ModalFooter, ModalHeader, Section, Tooltip, prelude::*,+ CommonAnimationExt, KeyBinding, Modal, ModalFooter, ModalHeader, Section, Tooltip,+ WithScrollbar, prelude::*,};use util::ResultExt as _;use workspace::{ModalView, Workspace};@@ -252,6 +253,7 @@ pub struct ConfigureContextServerModal {source: ConfigurationSource,state: State,original_server_id: Option<ContextServerId>,+ scroll_handle: ScrollHandle,}impl ConfigureContextServerModal {@@ -361,6 +363,7 @@ impl ConfigureContextServerModal {window,cx,),+ scroll_handle: ScrollHandle::new(),})})})@@ -680,6 +683,7 @@ impl ConfigureContextServerModal {impl Render for ConfigureContextServerModal {fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {+ let scroll_handle = self.scroll_handle.clone();div().elevation_3(cx).w(rems(34.))@@ -699,14 +703,29 @@ impl Render for ConfigureContextServerModal {Modal::new("configure-context-server", None).header(self.render_modal_header()).section(- Section::new()- .child(self.render_modal_description(window, cx))- .child(self.render_modal_content(cx))- .child(match &self.state {- State::Idle => div(),- State::Waiting => Self::render_waiting_for_context_server(),- State::Error(error) => Self::render_modal_error(error.clone()),- }),+ Section::new().child(+ div()+ .size_full()+ .child(+ div()+ .id("modal-content")+ .max_h(vh(0.7, window))+ .overflow_y_scroll()+ .track_scroll(&scroll_handle)+ .child(self.render_modal_description(window, cx))+ .child(self.render_modal_content(cx))+ .child(match &self.state {+ State::Idle => div(),+ State::Waiting => {+ Self::render_waiting_for_context_server()+ }+ State::Error(error) => {+ Self::render_modal_error(error.clone())+ }+ }),+ )+ .vertical_scrollbar_for(scroll_handle, window, cx),+ ),).footer(self.render_modal_footer(cx)),)