ui: picker: Render matches/total counts

pull/578/head
Blaž Hrastnik 3 years ago
parent b635e35818
commit f20dc1283d

@ -393,6 +393,8 @@ impl<T: 'static> Component for Picker<T> {
area
};
let text_style = cx.editor.theme.get("ui.text");
// -- Render the frame:
// clear area
let background = cx.editor.theme.get("ui.background");
@ -408,6 +410,15 @@ impl<T: 'static> Component for Picker<T> {
// -- Render the input bar:
let count = format!("{}/{}", self.matches.len(), self.options.len());
surface.set_stringn(
(area.x + area.width).saturating_sub(count.len() as u16 + 1),
area.y,
&count,
(count.len()).min(area.width as usize),
text_style,
);
let area = Rect::new(inner.x + 1, inner.y, inner.width - 1, 1);
self.prompt.render(area, surface, cx);
@ -425,7 +436,6 @@ impl<T: 'static> Component for Picker<T> {
// subtract the area of the prompt (-2) and current item marker " > " (-3)
let inner = Rect::new(inner.x + 3, inner.y + 2, inner.width - 3, inner.height - 2);
let style = cx.editor.theme.get("ui.text");
let selected = Style::default().fg(Color::Rgb(255, 255, 255));
let rows = inner.height;
@ -448,7 +458,7 @@ impl<T: 'static> Component for Picker<T> {
if i == (self.cursor - offset) {
selected
} else {
style
text_style
},
true,
);

Loading…
Cancel
Save