mirror of
https://github.com/FliegendeWurst/tmux-thumbs.git
synced 2024-11-22 04:45:00 +00:00
Fix selection glitch
This commit is contained in:
parent
84f61085c5
commit
4a9d916a2b
19
src/view.rs
19
src/view.rs
@ -51,20 +51,23 @@ impl<'a> View<'a> {
|
|||||||
|
|
||||||
rustbox.set_output_mode(OutputMode::EightBit);
|
rustbox.set_output_mode(OutputMode::EightBit);
|
||||||
|
|
||||||
for (index, line) in self.state.lines.iter().enumerate() {
|
|
||||||
let clean = line.trim_end_matches(|c: char| c.is_whitespace());
|
|
||||||
|
|
||||||
if clean.len() > 0 {
|
|
||||||
rustbox.print(0, index, rustbox::RB_NORMAL, Color::White, Color::Black, line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
let mut typed_hint: String = "".to_owned();
|
let mut typed_hint: String = "".to_owned();
|
||||||
let matches = self.state.matches(self.reverse, self.unique);
|
let matches = self.state.matches(self.reverse, self.unique);
|
||||||
let longest_hint = matches.iter().filter_map(|m| m.hint.clone()).max_by(|x, y| x.len().cmp(&y.len())).unwrap().clone();
|
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;
|
let mut selected;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
|
rustbox.clear();
|
||||||
|
rustbox.present();
|
||||||
|
|
||||||
|
for (index, line) in self.state.lines.iter().enumerate() {
|
||||||
|
let clean = line.trim_end_matches(|c: char| c.is_whitespace());
|
||||||
|
|
||||||
|
if clean.len() > 0 {
|
||||||
|
rustbox.print(0, index, rustbox::RB_NORMAL, Color::White, Color::Black, format!("{}\n", line).to_string().as_str());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
selected = matches.last();
|
selected = matches.last();
|
||||||
|
|
||||||
match matches.iter().enumerate().find(|&h| h.0 == self.skip) {
|
match matches.iter().enumerate().find(|&h| h.0 == self.skip) {
|
||||||
|
Loading…
Reference in New Issue
Block a user