chore: tentative fix 
    
      
      
      
        
        dino 
      
      created 1 week ago 
    
   
  
  
  Remove the changes introduced in the previous commit and update the
`MessageEditor.confirm_mention_for_selection` method in order to request
autoscroll from the editor twice, one of them delayed, as this appears
to fix the scrolling issue, regardless of the number of cursors used.
I'm not yet entirely sure why this is the case, so further investigation
is probably warranted in order to actually understand if this is the
best fix we can do right now, and why. 
  
  
  
    
   
 
  Change summary 
  crates/agent_ui/src/acp/message_editor.rs | 19 +++++++++++++++++++
crates/editor/src/display_map.rs          |  9 ---------
crates/editor/src/display_map/fold_map.rs | 11 ++++-------
crates/editor/src/scroll/autoscroll.rs    |  2 +-
4 files changed, 24 insertions(+), 17 deletions(-)
 
 
  Detailed changes 
  
  
    
    @@ -598,6 +598,25 @@ impl MessageEditor {
                 ),
             );
         }
+ 
+        self.editor.update(cx, |editor, cx| { 
+            editor.request_autoscroll(editor::scroll::Autoscroll::fit(), cx); 
+        }); 
+ 
+        cx.spawn(async |this, cx| { 
+            // Wait 2 frames at 120 FPS. 
+            cx.background_executor() 
+                .timer(Duration::from_millis(16)) 
+                .await; 
+ 
+            this.update(cx, |this, cx| { 
+                this.editor.update(cx, |editor, cx| { 
+                    editor.request_autoscroll(editor::scroll::Autoscroll::fit(), cx); 
+                }); 
+            }) 
+            .ok(); 
+        }) 
+        .detach(); 
     }
 
     fn confirm_mention_for_thread(
 
   
  
  
    
    @@ -879,15 +879,6 @@ impl DisplaySnapshot {
         DisplayPoint(block_point)
     }
 
-    pub fn point_to_display_point2(&self, point: MultiBufferPoint, bias: Bias) -> DisplayPoint {
-        let inlay_point = self.inlay_snapshot().to_inlay_point(point);
-        let fold_point = dbg!(self.fold_snapshot().to_fold_point(inlay_point, bias));
-        let tab_point = self.tab_snapshot().to_tab_point(fold_point);
-        let wrap_point = self.wrap_snapshot().tab_point_to_wrap_point(tab_point);
-        let block_point = self.block_snapshot.to_block_point(wrap_point);
-        DisplayPoint(block_point)
-    }
-
     pub fn display_point_to_point(&self, point: DisplayPoint, bias: Bias) -> Point {
         self.inlay_snapshot()
             .to_buffer_point(self.display_point_to_inlay_point(point, bias))
 
   
  
  
    
    @@ -114,9 +114,8 @@ impl FoldPoint {
         let overshoot = self.0 - cursor.start().1.output.lines;
         let mut offset = cursor.start().1.output.len;
         if !overshoot.is_zero() {
-            // todo! is this important?
-            // let transform = cursor.item().expect("display point out of range");
-            // assert!(transform.placeholder.is_none());
+            let transform = cursor.item().expect("display point out of range"); 
+            assert!(transform.placeholder.is_none()); 
             let end_inlay_offset = snapshot
                 .inlay_snapshot
                 .to_offset(InlayPoint(cursor.start().1.input.lines + overshoot));
@@ -521,17 +520,15 @@ impl FoldMap {
                         const ELLIPSIS: &str = "⋯";
 
                         let fold_id = fold.id;
-                        let text = " Untitled (1:10) ";
-                        let output = TextSummary::from(text);
                         new_transforms.push(
                             Transform {
                                 summary: TransformSummary {
-                                    output,
+                                    output: TextSummary::from(ELLIPSIS), 
                                     input: inlay_snapshot
                                         .text_summary_for_range(fold_range.start..fold_range.end),
                                 },
                                 placeholder: Some(TransformPlaceholder {
-                                    text: text,
+                                    text: ELLIPSIS, 
                                     chars: 1,
                                     renderer: ChunkRenderer {
                                         id: ChunkRendererId::Fold(fold.id),
 
   
  
  
    
    @@ -158,7 +158,7 @@ impl Editor {
                 .row()
                 .as_f64();
             target_bottom = display_map
-                .point_to_display_point2(selections.last().unwrap().head(), text::Bias::Left)
+                .point_to_display_point(selections.last().unwrap().head(), text::Bias::Left) 
                 .row()
                 .next_row()
                 .as_f64();