Add scrollbars setting

This commit is contained in:
Mikayla Maki
2023-05-17 14:09:26 -07:00
parent 1c9a7a7ad8
commit ae3394f4de
4 changed files with 44 additions and 1 deletions
+9
View File
@@ -516,6 +516,15 @@ pub struct EditorSnapshot {
ongoing_scroll: OngoingScroll,
}
impl EditorSnapshot {
fn has_scrollbar_info(&self) -> bool {
self.buffer_snapshot
.git_diff_hunks_in_range(0..self.max_point().row(), false)
.next()
.is_some()
}
}
#[derive(Clone, Debug)]
struct SelectionHistoryEntry {
selections: Arc<[Selection<Anchor>]>,
+9 -1
View File
@@ -2058,7 +2058,15 @@ impl Element<Editor> for EditorElement {
));
}
let show_scrollbars = editor.scroll_manager.scrollbars_visible();
let show_scrollbars = match cx.global::<Settings>().show_scrollbars {
settings::ShowScrollbars::Auto => {
snapshot.has_scrollbar_info()
|| editor.scroll_manager.scrollbars_visible()
}
settings::ShowScrollbars::System => editor.scroll_manager.scrollbars_visible(),
settings::ShowScrollbars::Always => true,
};
let include_root = editor
.project
.as_ref()