@@ -7,7 +7,7 @@ import { IDisposable } from 'vs/base/common/lifecycle';
7
7
import { Position } from 'vs/editor/common/core/position' ;
8
8
import { Range } from 'vs/editor/common/core/range' ;
9
9
import * as editorCommon from 'vs/editor/common/editorCommon' ;
10
- import { IModelDecoration , ITextModel } from 'vs/editor/common/model' ;
10
+ import { IModelDecoration , ITextModel , PositionAffinity } from 'vs/editor/common/model' ;
11
11
import { IViewModelLinesCollection } from 'vs/editor/common/viewModel/splitLinesCollection' ;
12
12
import { ICoordinatesConverter , InlineDecoration , InlineDecorationType , ViewModelDecoration } from 'vs/editor/common/viewModel/viewModel' ;
13
13
import { filterValidationDecorations } from 'vs/editor/common/config/editorOptions' ;
@@ -81,11 +81,13 @@ export class ViewModelDecorations implements IDisposable {
81
81
const options = modelDecoration . options ;
82
82
let viewRange : Range ;
83
83
if ( options . isWholeLine ) {
84
- const start = this . _coordinatesConverter . convertModelPositionToViewPosition ( new Position ( modelRange . startLineNumber , 1 ) ) ;
85
- const end = this . _coordinatesConverter . convertModelPositionToViewPosition ( new Position ( modelRange . endLineNumber , this . model . getLineMaxColumn ( modelRange . endLineNumber ) ) ) ;
84
+ const start = this . _coordinatesConverter . convertModelPositionToViewPosition ( new Position ( modelRange . startLineNumber , 1 ) , PositionAffinity . Left ) ;
85
+ const end = this . _coordinatesConverter . convertModelPositionToViewPosition ( new Position ( modelRange . endLineNumber , this . model . getLineMaxColumn ( modelRange . endLineNumber ) ) , PositionAffinity . Right ) ;
86
86
viewRange = new Range ( start . lineNumber , start . column , end . lineNumber , end . column ) ;
87
87
} else {
88
- viewRange = this . _coordinatesConverter . convertModelRangeToViewRange ( modelRange ) ;
88
+ // For backwards compatibility reasons, we want injected text before any decoration.
89
+ // Thus, move decorations to the right.
90
+ viewRange = this . _coordinatesConverter . convertModelRangeToViewRange ( modelRange , PositionAffinity . Right ) ;
89
91
}
90
92
r = new ViewModelDecoration ( viewRange , options ) ;
91
93
this . _decorationsCache [ id ] = r ;
0 commit comments