Skip to content

Commit

Permalink
ui: Paginate prompt completion
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer committed Jun 23, 2021
1 parent 3606d8b commit 39dc09e
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions helix-term/src/ui/prompt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,17 +292,21 @@ impl Prompt {
let area = completion_area;
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);

let mut row = 0;
let mut col = 0;

// TODO: paginate
for (i, (_range, completion)) in self
.completion
.iter()
.enumerate()
.take(height as usize * cols as usize)
for (i, (_range, completion)) in
self.completion.iter().enumerate().skip(offset).take(items)
{
let color = if Some(i) == self.selection {
// Style::default().bg(Color::Rgb(104, 60, 232))
Expand Down

0 comments on commit 39dc09e

Please sign in to comment.