mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-12 13:24:19 +00:00
Trigger scroll_to
on code action list when moving selection (#3026)
Release Notes: - Fixed the code action popup menu not scrolling as selection moves.
This commit is contained in:
commit
ff5d0f2aeb
1 changed files with 4 additions and 0 deletions
|
@ -1131,12 +1131,14 @@ struct CodeActionsMenu {
|
||||||
impl CodeActionsMenu {
|
impl CodeActionsMenu {
|
||||||
fn select_first(&mut self, cx: &mut ViewContext<Editor>) {
|
fn select_first(&mut self, cx: &mut ViewContext<Editor>) {
|
||||||
self.selected_item = 0;
|
self.selected_item = 0;
|
||||||
|
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_prev(&mut self, cx: &mut ViewContext<Editor>) {
|
fn select_prev(&mut self, cx: &mut ViewContext<Editor>) {
|
||||||
if self.selected_item > 0 {
|
if self.selected_item > 0 {
|
||||||
self.selected_item -= 1;
|
self.selected_item -= 1;
|
||||||
|
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1144,12 +1146,14 @@ impl CodeActionsMenu {
|
||||||
fn select_next(&mut self, cx: &mut ViewContext<Editor>) {
|
fn select_next(&mut self, cx: &mut ViewContext<Editor>) {
|
||||||
if self.selected_item + 1 < self.actions.len() {
|
if self.selected_item + 1 < self.actions.len() {
|
||||||
self.selected_item += 1;
|
self.selected_item += 1;
|
||||||
|
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn select_last(&mut self, cx: &mut ViewContext<Editor>) {
|
fn select_last(&mut self, cx: &mut ViewContext<Editor>) {
|
||||||
self.selected_item = self.actions.len() - 1;
|
self.selected_item = self.actions.len() - 1;
|
||||||
|
self.list.scroll_to(ScrollTarget::Show(self.selected_item));
|
||||||
cx.notify()
|
cx.notify()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue