Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
Prevent scrollbar from covering bottom right text in terminal (#33636)
ddoemonnfd1beedb16fc
diff --git a/crates/terminal_view/src/terminal_view.rs b/crates/terminal_view/src/terminal_view.rsindex 0c05aec85e0..0ec5f816d52 100644--- a/crates/terminal_view/src/terminal_view.rs+++ b/crates/terminal_view/src/terminal_view.rs@@ -64,8 +64,8 @@ use std::{};const CURSOR_BLINK_INTERVAL: Duration = Duration::from_millis(500);-const GIT_DIFF_PATH_PREFIXES: &[&str] = &["a", "b"];+const TERMINAL_SCROLLBAR_WIDTH: Pixels = px(12.);/// Event to transmit the scroll from the element to the view#[derive(Clone, Debug, PartialEq)]@@ -956,13 +956,12 @@ impl TerminalView {.on_scroll_wheel(cx.listener(|_, _, _window, cx| {cx.notify();}))- .h_full().absolute()- .right_1()- .top_1()+ .top_0().bottom_0()- .w(px(12.))- .cursor_default()+ .right_0()+ .h_full()+ .w(TERMINAL_SCROLLBAR_WIDTH).children(Scrollbar::vertical(self.scrollbar_state.clone())),)}@@ -1496,6 +1495,16 @@ impl Render for TerminalView {let focused = self.focus_handle.is_focused(window);+ // Always calculate scrollbar width to prevent layout shift+ let scrollbar_width = if Self::should_show_scrollbar(cx)+ && self.content_mode(window, cx).is_scrollable()+ && self.terminal.read(cx).total_lines() > self.terminal.read(cx).viewport_lines()+ {+ TERMINAL_SCROLLBAR_WIDTH+ } else {+ px(0.)+ };+div().id("terminal-view").size_full()@@ -1545,6 +1554,8 @@ impl Render for TerminalView {// TODO: Oddly this wrapper div is needed for TerminalElement to not steal events from the context menudiv().size_full()+ .bg(cx.theme().colors().editor_background)+ .when(scrollbar_width > px(0.), |div| div.pr(scrollbar_width)).child(TerminalElement::new(terminal_handle,terminal_view_handle,