Fix picker won't scroll down when it hits the bottom #1544 (#1567)

This commit is contained in:
Benjamin 2022-01-23 15:06:28 +01:00 committed by GitHub
parent 759b850859
commit 4044c70eb2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -500,7 +500,7 @@ fn render(&mut self, area: Rect, surface: &mut Surface, cx: &mut Context) {
let selected = cx.editor.theme.get("ui.text.focus");
let rows = inner.height;
let offset = self.cursor / std::cmp::max(1, (rows as usize) * (rows as usize));
let offset = self.cursor - (self.cursor % std::cmp::max(1, rows as usize));
let files = self.matches.iter().skip(offset).map(|(index, _score)| {
(index, self.options.get(*index).unwrap()) // get_unchecked