@@ -593,9 +593,9 @@ pub mod simple_message_notification {
use gpui::{
AnyElement, DismissEvent, EventEmitter, FocusHandle, Focusable, ParentElement, Render,
- SharedString, Styled,
+ ScrollHandle, SharedString, Styled,
};
- use ui::prelude::*;
+ use ui::{WithScrollbar, prelude::*};
use crate::notifications::NotificationFrame;
@@ -617,6 +617,7 @@ pub mod simple_message_notification {
show_close_button: bool,
show_suppress_button: bool,
title: Option<SharedString>,
+ scroll_handle: ScrollHandle,
}
impl Focusable for MessageNotification {
@@ -661,6 +662,7 @@ pub mod simple_message_notification {
show_suppress_button: true,
title: None,
focus_handle: cx.focus_handle(),
+ scroll_handle: ScrollHandle::new(),
}
}
@@ -777,7 +779,18 @@ pub mod simple_message_notification {
fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement {
NotificationFrame::new()
.with_title(self.title.clone())
- .with_content((self.build_content)(window, cx))
+ .with_content(
+ div()
+ .child(
+ div()
+ .id("message-notification-content")
+ .max_h(vh(0.6, window))
+ .overflow_y_scroll()
+ .track_scroll(&self.scroll_handle.clone())
+ .child((self.build_content)(window, cx)),
+ )
+ .vertical_scrollbar_for(self.scroll_handle.clone(), window, cx),
+ )
.show_close_button(self.show_close_button)
.show_suppress_button(self.show_suppress_button)
.on_close(cx.listener(|_, suppress, _, cx| {