@@ -711,7 +711,7 @@ export class LiveStrategy3 extends EditModeStrategy {
711
711
}
712
712
713
713
private async _computeDiff ( ) : Promise < IDocumentDiff > {
714
- const diff = await this . _editorWorkerService . computeDiff ( this . _session . textModel0 . uri , this . _session . textModelN . uri , { ignoreTrimWhitespace : false , maxComputationTimeMs : 5000 , computeMoves : false } , 'advanced' ) ;
714
+ const diff = await this . _editorWorkerService . computeDiff ( this . _session . textModel0 . uri , this . _session . textModelN . uri , { ignoreTrimWhitespace : false , maxComputationTimeMs : Number . MAX_SAFE_INTEGER , computeMoves : false } , 'advanced' ) ;
715
715
716
716
if ( ! diff || diff . changes . length === 0 ) {
717
717
return { identical : false , quitEarly : false , changes : [ ] , moves : [ ] } ;
@@ -750,8 +750,6 @@ export class LiveStrategy3 extends EditModeStrategy {
750
750
751
751
this . _sessionStore . clear ( ) ;
752
752
753
- this . _updateSummaryMessage ( diff . changes ) ;
754
-
755
753
if ( diff . identical || diff . changes . length === 0 ) {
756
754
757
755
if ( isAfterManualInteraction ) {
@@ -767,10 +765,10 @@ export class LiveStrategy3 extends EditModeStrategy {
767
765
const mightContainRTL = this . _session . textModel0 . mightContainRTL ( ) ?? false ;
768
766
const renderOptions = RenderOptions . fromEditor ( this . _editor ) ;
769
767
770
- let widgetData : { distance : number ; position : Position ; actions : IAction [ ] } | undefined ;
771
-
772
- for ( const { original, modified, innerChanges } of diff . changes ) {
768
+ let widgetData : { distance : number ; position : Position ; actions : IAction [ ] ; mapping : LineRangeMapping } | undefined ;
773
769
770
+ for ( const mapping of diff . changes ) {
771
+ const { original, modified, innerChanges } = mapping ;
774
772
const modifiedRange : Range = modified . isEmpty
775
773
? new Range ( modified . startLineNumber , 1 , modified . startLineNumber , this . _session . textModelN . getLineLength ( modified . startLineNumber ) )
776
774
: new Range ( modified . startLineNumber , 1 , modified . endLineNumberExclusive - 1 , this . _session . textModelN . getLineLength ( modified . endLineNumberExclusive - 1 ) ) ;
@@ -895,7 +893,7 @@ export class LiveStrategy3 extends EditModeStrategy {
895
893
: zoneLineNumber - modifiedRange . endLineNumber ;
896
894
897
895
if ( ! widgetData || widgetData . distance > myDistance ) {
898
- widgetData = { distance : myDistance , position : modifiedRange . getStartPosition ( ) . delta ( - 1 ) , actions } ;
896
+ widgetData = { distance : myDistance , position : modifiedRange . getStartPosition ( ) . delta ( - 1 ) , mapping , actions } ;
899
897
}
900
898
}
901
899
}
@@ -904,6 +902,9 @@ export class LiveStrategy3 extends EditModeStrategy {
904
902
this . _zone . widget . setExtraButtons ( widgetData . actions ) ;
905
903
this . _zone . updatePositionAndHeight ( widgetData . position ) ;
906
904
this . _editor . revealPositionInCenterIfOutsideViewport ( widgetData . position ) ;
905
+
906
+ this . _updateSummaryMessage ( widgetData . mapping , diff . changes ) ;
907
+
907
908
}
908
909
909
910
const decorations = this . _editor . createDecorationsCollection ( newDecorations ) ;
@@ -940,18 +941,20 @@ export class LiveStrategy3 extends EditModeStrategy {
940
941
}
941
942
}
942
943
943
- protected _updateSummaryMessage ( mappings : readonly LineRangeMapping [ ] ) {
944
- let linesChanged = 0 ;
945
- for ( const change of mappings ) {
946
- linesChanged += change . changedLineCount ;
947
- }
944
+ protected _updateSummaryMessage ( current : LineRangeMapping , mappings : readonly LineRangeMapping [ ] ) {
945
+ const thisLinesChange = current . changedLineCount ;
946
+ const allLinesChanges = mappings . reduce ( ( total , change ) => total + change . changedLineCount , 0 ) ;
948
947
let message : string ;
949
- if ( linesChanged === 0 ) {
948
+ if ( allLinesChanges === 0 ) {
950
949
message = localize ( 'lines.0' , "Nothing changed" ) ;
951
- } else if ( linesChanged === 1 ) {
950
+ } else if ( allLinesChanges === 1 ) {
952
951
message = localize ( 'lines.1' , "Changed 1 line" ) ;
953
952
} else {
954
- message = localize ( 'lines.N' , "Changed {0} lines" , linesChanged ) ;
953
+ if ( mappings . length === 1 ) {
954
+ message = localize ( 'lines.N' , "Changed {0} lines" , allLinesChanges ) ;
955
+ } else {
956
+ message = localize ( 'lines.NM' , "{0} of {1} changed lines" , thisLinesChange , allLinesChanges ) ;
957
+ }
955
958
}
956
959
this . _zone . widget . updateStatus ( message ) ;
957
960
}
0 commit comments