Center the selected item when updating outline query

Co-Authored-By: Max Brunsfeld <max@zed.dev>
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2022-01-14 17:53:06 +01:00
parent e4c0fc6ad5
commit ce51196eab
5 changed files with 54 additions and 22 deletions

View file

@ -1,8 +1,8 @@
use gpui::{
action,
elements::{
Align, ConstrainedBox, Empty, Flex, Label, MouseEventHandler, ParentElement, Svg,
UniformList, UniformListState,
Align, ConstrainedBox, Empty, Flex, Label, MouseEventHandler, ParentElement, ScrollTarget,
Svg, UniformList, UniformListState,
},
keymap::{
self,
@ -278,7 +278,7 @@ impl ProjectPanel {
fn autoscroll(&mut self) {
if let Some(selection) = self.selection {
self.list.scroll_to(selection.index);
self.list.scroll_to(ScrollTarget::Show(selection.index));
}
}