File tree Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Expand file tree Collapse file tree 2 files changed +17
-16
lines changed Original file line number Diff line number Diff line change @@ -1421,15 +1421,18 @@ impl AcpThread {
14211421
14221422                if  let  Some ( Some ( location) )  = resolved_locations. last ( )  { 
14231423                    project. update ( cx,  |project,  cx| { 
1424-                         let  should_ignore = if  let  Some ( agent_location)  = project. agent_location ( )  { 
1424+                         let  should_ignore = if  let  Some ( agent_location)  = project
1425+                             . agent_location ( ) 
1426+                             . filter ( |agent_location| agent_location. buffer  == location. buffer ) 
1427+                         { 
14251428                            let  snapshot = location. buffer . read ( cx) . snapshot ( ) ; 
14261429                            let  old_position = agent_location. position . to_point ( & snapshot) ; 
14271430                            let  new_position = location. position . to_point ( & snapshot) ; 
1428-                             agent_location . buffer  == location . buffer 
1429-                                  // ignore this so that when we get updates from the edit tool 
1430-                                  // the position doesn't reset to the startof line 
1431-                                 &&  ( old_position. row  == new_position. row 
1432-                                      && old_position. column  > new_position. column ) 
1431+ 
1432+                             // ignore this so that when we get updates from the edit tool 
1433+                             // the position doesn't reset to the startof line 
1434+                             old_position. row  == new_position. row 
1435+                                 && old_position. column  > new_position. column 
14331436                        }  else  { 
14341437                            false 
14351438                        } ; 
Original file line number Diff line number Diff line change @@ -6165,22 +6165,20 @@ impl MultiBufferSnapshot {
61656165    )  -> SmallVec < [ Locator ;  1 ] >  { 
61666166        let  mut  sorted_ids = ids. into_iter ( ) . collect :: < SmallVec < [ _ ;  1 ] > > ( ) ; 
61676167        sorted_ids. sort_unstable ( ) ; 
6168+         sorted_ids. dedup ( ) ; 
61686169        let  mut  locators = SmallVec :: new ( ) ; 
61696170
61706171        while  sorted_ids. last ( )  == Some ( & ExcerptId :: max ( ) )  { 
61716172            sorted_ids. pop ( ) ; 
6172-             if  let  Some ( mapping)  = self . excerpt_ids . last ( )  { 
6173-                 locators. push ( mapping. locator . clone ( ) ) ; 
6174-             } 
6173+             locators. push ( Locator :: max ( ) ) ; 
61756174        } 
61766175
6177-         let  mut  sorted_ids = sorted_ids. into_iter ( ) . dedup ( ) . peekable ( ) ; 
6178-         if  sorted_ids. peek ( )  == Some ( & ExcerptId :: min ( ) )  { 
6179-             sorted_ids. next ( ) ; 
6180-             if  let  Some ( mapping)  = self . excerpt_ids . first ( )  { 
6181-                 locators. push ( mapping. locator . clone ( ) ) ; 
6182-             } 
6183-         } 
6176+         let  mut  sorted_ids = sorted_ids. into_iter ( ) . peekable ( ) ; 
6177+         locators. extend ( 
6178+             sorted_ids
6179+                 . peeking_take_while ( |excerpt| * excerpt == ExcerptId :: min ( ) ) 
6180+                 . map ( |_| Locator :: min ( ) ) , 
6181+         ) ; 
61846182
61856183        let  mut  cursor = self . excerpt_ids . cursor :: < ExcerptId > ( ( ) ) ; 
61866184        for  id in  sorted_ids { 
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments