mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-22 12:54:59 +00:00
Fix bug with reverse navigation
This commit is contained in:
parent
1a6cc7a596
commit
c828ff39d7
11
src/view.rs
11
src/view.rs
@ -58,6 +58,8 @@ impl<'a> View<'a> {
|
||||
let longest_hint = matches.iter().filter_map(|m| m.hint.clone()).max_by(|x, y| x.len().cmp(&y.len())).unwrap().clone();
|
||||
let mut selected;
|
||||
|
||||
self.skip = if self.reverse { matches.len() - 1 } else { 0 };
|
||||
|
||||
loop {
|
||||
rustbox.clear();
|
||||
rustbox.present();
|
||||
@ -70,14 +72,7 @@ impl<'a> View<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
selected = matches.last();
|
||||
|
||||
match matches.iter().enumerate().find(|&h| h.0 == self.skip) {
|
||||
Some(hm) => {
|
||||
selected = Some(hm.1);
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
selected = matches.get(self.skip);
|
||||
|
||||
for mat in matches.iter() {
|
||||
let selected_color = if selected == Some(mat) {
|
||||
|
Loading…
Reference in New Issue
Block a user