@@ -88,7 +88,6 @@ export interface IChatRendererDelegate {
88
88
}
89
89
90
90
export class ChatListItemRenderer extends Disposable implements ITreeRenderer < ChatTreeItem , FuzzyScore , IChatListItemTemplate > {
91
- static readonly cursorCharacter = '\u258c' ;
92
91
static readonly ID = 'item' ;
93
92
94
93
private readonly codeBlocksByResponseId = new Map < string , IChatCodeBlockInfo [ ] > ( ) ;
@@ -368,12 +367,7 @@ export class ChatListItemRenderer extends Disposable implements ITreeRenderer<Ch
368
367
isFullyRendered : renderValue . isFullString
369
368
} ;
370
369
371
- // Don't add the cursor if it will go after a codeblock, since this will always cause layout shifting
372
- // when the codeblock is the last thing in the response, and that happens often.
373
- const plusCursor = renderValue . value . match ( / ` ` ` \s * $ / ) ?
374
- renderValue . value :
375
- renderValue . value + ` ${ ChatListItemRenderer . cursorCharacter } ` ;
376
- const result = this . renderMarkdown ( new MarkdownString ( plusCursor ) , element , disposables , templateData , true ) ;
370
+ const result = this . renderMarkdown ( new MarkdownString ( renderValue . value ) , element , disposables , templateData , true ) ;
377
371
// Doing the progressive render
378
372
dom . clearNode ( templateData . value ) ;
379
373
templateData . value . appendChild ( result . element ) ;
@@ -754,28 +748,16 @@ class CodeBlockPart extends Disposable implements IChatResultCodeBlockPart {
754
748
}
755
749
756
750
private setText ( newText : string ) : void {
757
- let currentText = this . textModel . getLinesContent ( ) . join ( '\n' ) ;
751
+ const currentText = this . textModel . getLinesContent ( ) . join ( '\n' ) ;
758
752
if ( newText === currentText ) {
759
753
return ;
760
754
}
761
755
762
- let removedChars = 0 ;
763
- if ( currentText . endsWith ( ` ${ ChatListItemRenderer . cursorCharacter } ` ) ) {
764
- removedChars = 2 ;
765
- } else if ( currentText . endsWith ( ChatListItemRenderer . cursorCharacter ) ) {
766
- removedChars = 1 ;
767
- }
768
-
769
- if ( removedChars > 0 ) {
770
- currentText = currentText . slice ( 0 , currentText . length - removedChars ) ;
771
- }
772
-
773
756
if ( newText . startsWith ( currentText ) ) {
774
757
const text = newText . slice ( currentText . length ) ;
775
758
const lastLine = this . textModel . getLineCount ( ) ;
776
759
const lastCol = this . textModel . getLineMaxColumn ( lastLine ) ;
777
- const insertAtCol = lastCol - removedChars ;
778
- this . textModel . applyEdits ( [ { range : new Range ( lastLine , insertAtCol , lastLine , lastCol ) , text } ] ) ;
760
+ this . textModel . applyEdits ( [ { range : new Range ( lastLine , lastCol , lastLine , lastCol ) , text } ] ) ;
779
761
} else {
780
762
// console.log(`Failed to optimize setText`);
781
763
this . textModel . setValue ( newText ) ;
0 commit comments