ui: Paginate prompt completion

pull/353/head
Blaž Hrastnik 3 years ago
parent 3606d8bd24
commit 39dc09e6c4

@ -292,17 +292,21 @@ impl Prompt {
let area = completion_area; let area = completion_area;
let background = theme.get("ui.statusline"); let background = theme.get("ui.statusline");
let items = height as usize * cols as usize;
let offset = self
.selection
.map(|selection| selection / items * items)
.unwrap_or_default();
surface.clear_with(area, background); surface.clear_with(area, background);
let mut row = 0; let mut row = 0;
let mut col = 0; let mut col = 0;
// TODO: paginate // TODO: paginate
for (i, (_range, completion)) in self for (i, (_range, completion)) in
.completion self.completion.iter().enumerate().skip(offset).take(items)
.iter()
.enumerate()
.take(height as usize * cols as usize)
{ {
let color = if Some(i) == self.selection { let color = if Some(i) == self.selection {
// Style::default().bg(Color::Rgb(104, 60, 232)) // Style::default().bg(Color::Rgb(104, 60, 232))

Loading…
Cancel
Save