fix :previous_match selecting indirect matches
previous_match and :next_match are supposed to only select
direct match. This wasn't the case for :previous_match
Fix
@@ -282,23 +282,6 @@ impl Tree {
}
false
}
- pub fn try_select_next_match(&mut self) -> bool {
- for di in 0..self.lines.len() {
- let idx = (self.selection + di + 1) % self.lines.len();
- let line = &self.lines[idx];
- if !line.is_selectable() {
- continue;
- }
- if !line.direct_match {
- continue;
- }
- if line.score > 0 {
- self.selection = idx;
- return true;
- }
- }
- false
- }
pub fn try_select_previous_same_depth(&mut self) -> bool {
let depth = self.lines[self.selection].depth;
for di in (0..self.lines.len()).rev() {
@@ -332,6 +315,26 @@ impl Tree {
if !line.is_selectable() {
continue;
}
+ if !line.direct_match {
+ continue;
+ }
+ if line.score > 0 {
+ self.selection = idx;
+ return true;
+ }
+ }
+ false
+ }
+ pub fn try_select_next_match(&mut self) -> bool {
+ for di in 0..self.lines.len() {
+ let idx = (self.selection + di + 1) % self.lines.len();
+ let line = &self.lines[idx];
+ if !line.is_selectable() {
+ continue;
+ }
+ if !line.direct_match {
+ continue;
+ }
if line.score > 0 {
self.selection = idx;
return true;
