@@ -68,8 +68,6 @@ use serde::de::{self, Deserialize, Deserializer};
68
68
use grep_regex:: RegexMatcherBuilder ;
69
69
use grep_searcher:: { sinks, BinaryDetection , SearcherBuilder } ;
70
70
use ignore:: { DirEntry , WalkBuilder , WalkState } ;
71
- use itertools:: FoldWhile :: { Continue , Done } ;
72
- use itertools:: Itertools ;
73
71
use tokio_stream:: wrappers:: UnboundedReceiverStream ;
74
72
75
73
pub struct Context < ' a > {
@@ -5042,30 +5040,19 @@ fn move_selection(cx: &mut Context, direction: MoveSelection) {
5042
5040
// which would make the transaction to panic.
5043
5041
// Conflicts are resolved by picking only the top change in such case.
5044
5042
fn remove_conflicts ( changes : Vec < Change > ) -> Vec < Change > {
5045
- if changes. len ( ) > 2 {
5046
- changes
5047
- . into_iter ( )
5048
- . fold_while ( vec ! [ ] , |mut acc : Vec < Change > , change| {
5049
- if let Some ( last_change) = acc. pop ( ) {
5050
- if last_change. 0 >= change. 0 || last_change. 1 >= change. 1 {
5051
- acc. push ( last_change) ;
5052
- Done ( acc)
5053
- } else {
5054
- acc. push ( last_change) ;
5055
- acc. push ( change) ;
5056
- Continue ( acc)
5057
- }
5058
- } else {
5059
- acc. push ( change) ;
5060
- Continue ( acc)
5061
- }
5062
- } )
5063
- . into_inner ( )
5064
- } else {
5065
- changes
5043
+ let mut new_changes: Vec < Change > = Vec :: new ( ) ;
5044
+ for change in changes {
5045
+ match new_changes. last ( ) {
5046
+ Some ( last_change) if last_change. 0 >= change. 0 || last_change. 1 >= change. 1 => {
5047
+ return new_changes;
5048
+ }
5049
+ _ => new_changes. push ( change. clone ( ) ) ,
5050
+ }
5066
5051
}
5052
+
5053
+ new_changes
5067
5054
}
5068
- let flat: Vec < Change > = all_changes. into_iter ( ) . flatten ( ) . unique ( ) . collect ( ) ;
5055
+ let flat: Vec < Change > = all_changes. into_iter ( ) . flatten ( ) . collect ( ) ;
5069
5056
let filtered = remove_conflicts ( flat) ;
5070
5057
5071
5058
let new_selection = selection. clone ( ) . transform ( |range| {
0 commit comments