@@ -18,6 +18,7 @@ import { SymbolKind } from 'vs/editor/common/languages';
18
18
import { LineDecoration } from 'vs/editor/common/viewLayout/lineDecorations' ;
19
19
import { RunOnceScheduler } from 'vs/base/common/async' ;
20
20
import { IModelTokensChangedEvent } from 'vs/editor/common/textModelEvents' ;
21
+ import { Position } from 'vs/editor/common/core/position' ;
21
22
22
23
class StickyScrollController extends Disposable implements IEditorContribution {
23
24
@@ -201,12 +202,12 @@ class StickyScrollController extends Disposable implements IEditorContribution {
201
202
if ( ! beginningLinesConsidered . has ( start ) ) {
202
203
if ( topOfElementAtDepth >= topOfEndLine - 1 && topOfElementAtDepth < bottomOfEndLine - 2 ) {
203
204
beginningLinesConsidered . add ( start ) ;
204
- this . stickyScrollWidget . pushCodeLine ( new StickyScrollCodeLine ( model . getLineContent ( start ) , start , this . _editor , - 1 , bottomOfEndLine - bottomOfElementAtDepth ) ) ;
205
+ this . stickyScrollWidget . pushCodeLine ( new StickyScrollCodeLine ( start , this . _editor , - 1 , bottomOfEndLine - bottomOfElementAtDepth ) ) ;
205
206
break ;
206
207
}
207
208
else if ( bottomOfElementAtDepth > bottomOfBeginningLine - 1 && bottomOfElementAtDepth < bottomOfEndLine - 1 ) {
208
209
beginningLinesConsidered . add ( start ) ;
209
- this . stickyScrollWidget . pushCodeLine ( new StickyScrollCodeLine ( model . getLineContent ( start ) , start , this . _editor , 0 , 0 ) ) ;
210
+ this . stickyScrollWidget . pushCodeLine ( new StickyScrollCodeLine ( start , this . _editor , 0 , 0 ) ) ;
210
211
}
211
212
} else {
212
213
this . _ranges . splice ( index , 1 ) ;
@@ -228,7 +229,7 @@ class StickyScrollCodeLine {
228
229
229
230
public readonly effectiveLineHeight : number = 0 ;
230
231
231
- constructor ( private readonly _line : string , private readonly _lineNumber : number , private readonly _editor : IActiveCodeEditor ,
232
+ constructor ( private readonly _lineNumber : number , private readonly _editor : IActiveCodeEditor ,
232
233
private readonly _zIndex : number , private readonly _relativePosition : number ) {
233
234
this . effectiveLineHeight = this . _editor . getOption ( EditorOption . lineHeight ) + this . _relativePosition ;
234
235
}
@@ -240,16 +241,18 @@ class StickyScrollCodeLine {
240
241
getDomNode ( ) {
241
242
242
243
const root : HTMLElement = document . createElement ( 'div' ) ;
243
- const lineRenderingData = this . _editor . _getViewModel ( ) . getViewportViewLineRenderingData ( this . _editor . getVisibleRangesPlusViewportAboveBelow ( ) [ 0 ] , this . _lineNumber ) ;
244
+ const viewModel = this . _editor . _getViewModel ( ) ;
245
+ const viewLineNumber = viewModel . coordinatesConverter . convertModelPositionToViewPosition ( new Position ( this . _lineNumber , 1 ) ) . lineNumber ;
246
+ const lineRenderingData = viewModel . getViewLineRenderingData ( viewLineNumber ) ;
244
247
245
248
let actualInlineDecorations : LineDecoration [ ] ;
246
249
try {
247
- actualInlineDecorations = LineDecoration . filter ( lineRenderingData . inlineDecorations , this . _lineNumber , lineRenderingData . minColumn , lineRenderingData . maxColumn ) ;
250
+ actualInlineDecorations = LineDecoration . filter ( lineRenderingData . inlineDecorations , viewLineNumber , lineRenderingData . minColumn , lineRenderingData . maxColumn ) ;
248
251
} catch ( err ) {
249
252
actualInlineDecorations = [ ] ;
250
253
}
251
254
252
- const renderLineInput : RenderLineInput = new RenderLineInput ( true , true , this . _line , lineRenderingData . continuesWithWrappedLine ,
255
+ const renderLineInput : RenderLineInput = new RenderLineInput ( true , true , lineRenderingData . content , lineRenderingData . continuesWithWrappedLine ,
253
256
lineRenderingData . isBasicASCII , lineRenderingData . containsRTL , 0 , lineRenderingData . tokens , actualInlineDecorations , lineRenderingData . tabSize ,
254
257
lineRenderingData . startVisibleColumn , 1 , 1 , 1 , 100 , 'none' , true , true , null ) ;
255
258
0 commit comments