@@ -155,6 +155,21 @@ export abstract class AbstractLineHighlightOverlay extends DynamicViewOverlay {
155
155
return this . _renderData [ lineIndex ] ;
156
156
}
157
157
158
+ protected _shouldRenderInMargin ( ) : boolean {
159
+ return (
160
+ ( this . _renderLineHighlight === 'gutter' || this . _renderLineHighlight === 'all' )
161
+ && ( ! this . _renderLineHighlightOnlyWhenFocus || this . _focused )
162
+ ) ;
163
+ }
164
+
165
+ protected _shouldRenderInContent ( ) : boolean {
166
+ return (
167
+ ( this . _renderLineHighlight === 'line' || this . _renderLineHighlight === 'all' )
168
+ && this . _selectionIsEmpty
169
+ && ( ! this . _renderLineHighlightOnlyWhenFocus || this . _focused )
170
+ ) ;
171
+ }
172
+
158
173
protected abstract _shouldRenderThis ( ) : boolean ;
159
174
protected abstract _shouldRenderOther ( ) : boolean ;
160
175
protected abstract _renderOne ( ctx : RenderingContext ) : string ;
@@ -167,40 +182,23 @@ export class CurrentLineHighlightOverlay extends AbstractLineHighlightOverlay {
167
182
return `<div class="${ className } " style="width:${ Math . max ( ctx . scrollWidth , this . _contentWidth ) } px; height:${ this . _lineHeight } px;"></div>` ;
168
183
}
169
184
protected _shouldRenderThis ( ) : boolean {
170
- return (
171
- ( this . _renderLineHighlight === 'line' || this . _renderLineHighlight === 'all' )
172
- && this . _selectionIsEmpty
173
- && ( ! this . _renderLineHighlightOnlyWhenFocus || this . _focused )
174
- ) ;
185
+ return this . _shouldRenderInContent ( ) ;
175
186
}
176
187
protected _shouldRenderOther ( ) : boolean {
177
- return (
178
- ( this . _renderLineHighlight === 'gutter' || this . _renderLineHighlight === 'all' )
179
- && ( ! this . _renderLineHighlightOnlyWhenFocus || this . _focused )
180
- ) ;
188
+ return this . _shouldRenderInMargin ( ) ;
181
189
}
182
190
}
183
191
184
192
export class CurrentLineMarginHighlightOverlay extends AbstractLineHighlightOverlay {
185
193
protected _renderOne ( ctx : RenderingContext ) : string {
186
- const className = 'current-line' + ( this . _shouldRenderMargin ( ) ? ' current-line-margin' : '' ) + ( this . _shouldRenderOther ( ) ? ' current-line-margin-both' : '' ) ;
194
+ const className = 'current-line' + ( this . _shouldRenderInMargin ( ) ? ' current-line-margin' : '' ) + ( this . _shouldRenderOther ( ) ? ' current-line-margin-both' : '' ) ;
187
195
return `<div class="${ className } " style="width:${ this . _contentLeft } px; height:${ this . _lineHeight } px;"></div>` ;
188
196
}
189
- protected _shouldRenderMargin ( ) : boolean {
190
- return (
191
- ( this . _renderLineHighlight === 'gutter' || this . _renderLineHighlight === 'all' )
192
- && ( ! this . _renderLineHighlightOnlyWhenFocus || this . _focused )
193
- ) ;
194
- }
195
197
protected _shouldRenderThis ( ) : boolean {
196
198
return true ;
197
199
}
198
200
protected _shouldRenderOther ( ) : boolean {
199
- return (
200
- ( this . _renderLineHighlight === 'line' || this . _renderLineHighlight === 'all' )
201
- && this . _selectionIsEmpty
202
- && ( ! this . _renderLineHighlightOnlyWhenFocus || this . _focused )
203
- ) ;
201
+ return this . _shouldRenderInContent ( ) ;
204
202
}
205
203
}
206
204
0 commit comments