@@ -12,10 +12,10 @@ import { DeleteOperations } from 'vs/editor/common/controller/cursorDeleteOperat
1212import { CursorChangeReason } from 'vs/editor/common/controller/cursorEvents' ;
1313import { TypeOperations , TypeWithAutoClosingCommand } from 'vs/editor/common/controller/cursorTypeOperations' ;
1414import { Position } from 'vs/editor/common/core/position' ;
15- import { Range } from 'vs/editor/common/core/range' ;
15+ import { Range , IRange } from 'vs/editor/common/core/range' ;
1616import { ISelection , Selection , SelectionDirection } from 'vs/editor/common/core/selection' ;
1717import * as editorCommon from 'vs/editor/common/editorCommon' ;
18- import { IIdentifiedSingleEditOperation , ITextModel , TrackedRangeStickiness , IModelDeltaDecoration , ICursorStateComputer } from 'vs/editor/common/model' ;
18+ import { ITextModel , TrackedRangeStickiness , IModelDeltaDecoration , ICursorStateComputer , IIdentifiedSingleEditOperation , IValidEditOperation } from 'vs/editor/common/model' ;
1919import { RawContentChangedType } from 'vs/editor/common/model/textModelEvents' ;
2020import * as viewEvents from 'vs/editor/common/view/viewEvents' ;
2121import { IViewModel } from 'vs/editor/common/viewModel/viewModel' ;
@@ -903,8 +903,8 @@ class CommandExecutor {
903903 if ( commandsData . hadTrackedEditOperation && filteredOperations . length > 0 ) {
904904 filteredOperations [ 0 ] . _isTracked = true ;
905905 }
906- let selectionsAfter = ctx . model . pushEditOperations ( ctx . selectionsBefore , filteredOperations , ( inverseEditOperations : IIdentifiedSingleEditOperation [ ] ) : Selection [ ] => {
907- let groupedInverseEditOperations : IIdentifiedSingleEditOperation [ ] [ ] = [ ] ;
906+ let selectionsAfter = ctx . model . pushEditOperations ( ctx . selectionsBefore , filteredOperations , ( inverseEditOperations : IValidEditOperation [ ] ) : Selection [ ] => {
907+ let groupedInverseEditOperations : IValidEditOperation [ ] [ ] = [ ] ;
908908 for ( let i = 0 ; i < ctx . selectionsBefore . length ; i ++ ) {
909909 groupedInverseEditOperations [ i ] = [ ] ;
910910 }
@@ -915,7 +915,7 @@ class CommandExecutor {
915915 }
916916 groupedInverseEditOperations [ op . identifier . major ] . push ( op ) ;
917917 }
918- const minorBasedSorter = ( a : IIdentifiedSingleEditOperation , b : IIdentifiedSingleEditOperation ) => {
918+ const minorBasedSorter = ( a : IValidEditOperation , b : IValidEditOperation ) => {
919919 return a . identifier ! . minor - b . identifier ! . minor ;
920920 } ;
921921 let cursorSelections : Selection [ ] = [ ] ;
@@ -1000,8 +1000,8 @@ class CommandExecutor {
10001000 let operations : IIdentifiedSingleEditOperation [ ] = [ ] ;
10011001 let operationMinor = 0 ;
10021002
1003- const addEditOperation = ( selection : Range , text : string | null , forceMoveMarkers : boolean = false ) => {
1004- if ( selection . isEmpty ( ) && text === '' ) {
1003+ const addEditOperation = ( range : IRange , text : string | null , forceMoveMarkers : boolean = false ) => {
1004+ if ( Range . isEmpty ( range ) && text === '' ) {
10051005 // This command wants to add a no-op => no thank you
10061006 return ;
10071007 }
@@ -1010,20 +1010,21 @@ class CommandExecutor {
10101010 major : majorIdentifier ,
10111011 minor : operationMinor ++
10121012 } ,
1013- range : selection ,
1013+ range : range ,
10141014 text : text ,
10151015 forceMoveMarkers : forceMoveMarkers ,
10161016 isAutoWhitespaceEdit : command . insertsAutoWhitespace
10171017 } ) ;
10181018 } ;
10191019
10201020 let hadTrackedEditOperation = false ;
1021- const addTrackedEditOperation = ( selection : Range , text : string | null , forceMoveMarkers ?: boolean ) => {
1021+ const addTrackedEditOperation = ( selection : IRange , text : string | null , forceMoveMarkers ?: boolean ) => {
10221022 hadTrackedEditOperation = true ;
10231023 addEditOperation ( selection , text , forceMoveMarkers ) ;
10241024 } ;
10251025
1026- const trackSelection = ( selection : Selection , trackPreviousOnEmpty ?: boolean ) => {
1026+ const trackSelection = ( _selection : ISelection , trackPreviousOnEmpty ?: boolean ) => {
1027+ const selection = Selection . liftSelection ( _selection ) ;
10271028 let stickiness : TrackedRangeStickiness ;
10281029 if ( selection . isEmpty ( ) ) {
10291030 if ( typeof trackPreviousOnEmpty === 'boolean' ) {
@@ -1093,7 +1094,7 @@ class CommandExecutor {
10931094 const previousOp = operations [ i - 1 ] ;
10941095 const currentOp = operations [ i ] ;
10951096
1096- if ( previousOp . range . getStartPosition ( ) . isBefore ( currentOp . range . getEndPosition ( ) ) ) {
1097+ if ( Range . getStartPosition ( previousOp . range ) . isBefore ( Range . getEndPosition ( currentOp . range ) ) ) {
10971098
10981099 let loserMajor : number ;
10991100
0 commit comments