@@ -158,6 +158,9 @@ export class InteractiveEditorWidget {
158
158
private readonly _inputModel : ITextModel ;
159
159
private readonly _ctxInputEmpty : IContextKey < boolean > ;
160
160
private readonly _ctxMessageCropState : IContextKey < 'cropped' | 'not_cropped' | 'expanded' > ;
161
+ private readonly _ctxInnerCursorFirst : IContextKey < boolean > ;
162
+ private readonly _ctxInnerCursorLast : IContextKey < boolean > ;
163
+ private readonly _ctxInputEditorFocused : IContextKey < boolean > ;
161
164
162
165
private readonly _progressBar : ProgressBar ;
163
166
@@ -219,27 +222,32 @@ export class InteractiveEditorWidget {
219
222
this . _ctxMessageCropState = CTX_INTERACTIVE_EDITOR_MESSAGE_CROP_STATE . bindTo ( this . _contextKeyService ) ;
220
223
this . _ctxInputEmpty = CTX_INTERACTIVE_EDITOR_EMPTY . bindTo ( this . _contextKeyService ) ;
221
224
222
- const ctxInnerCursorFirst = CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST . bindTo ( this . _contextKeyService ) ;
223
- const ctxInnerCursorLast = CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST . bindTo ( this . _contextKeyService ) ;
224
- const ctxInputEditorFocused = CTX_INTERACTIVE_EDITOR_FOCUSED . bindTo ( this . _contextKeyService ) ;
225
+ this . _ctxInnerCursorFirst = CTX_INTERACTIVE_EDITOR_INNER_CURSOR_FIRST . bindTo ( this . _contextKeyService ) ;
226
+ this . _ctxInnerCursorLast = CTX_INTERACTIVE_EDITOR_INNER_CURSOR_LAST . bindTo ( this . _contextKeyService ) ;
227
+ this . _ctxInputEditorFocused = CTX_INTERACTIVE_EDITOR_FOCUSED . bindTo ( this . _contextKeyService ) ;
225
228
226
229
// (1) inner cursor position (last/first line selected)
227
230
const updateInnerCursorFirstLast = ( ) => {
228
231
const { lineNumber } = this . _inputEditor . getPosition ( ) ;
229
- ctxInnerCursorFirst . set ( lineNumber === 1 ) ;
230
- ctxInnerCursorLast . set ( lineNumber === this . _inputModel . getLineCount ( ) ) ;
232
+ this . _ctxInnerCursorFirst . set ( lineNumber === 1 ) ;
233
+ this . _ctxInnerCursorLast . set ( lineNumber === this . _inputModel . getLineCount ( ) ) ;
231
234
} ;
232
235
this . _store . add ( this . _inputEditor . onDidChangeCursorPosition ( updateInnerCursorFirstLast ) ) ;
233
236
updateInnerCursorFirstLast ( ) ;
234
237
235
238
// (2) input editor focused or not
236
239
const updateFocused = ( ) => {
237
240
const hasFocus = this . _inputEditor . hasWidgetFocus ( ) ;
238
- ctxInputEditorFocused . set ( hasFocus ) ;
241
+ this . _ctxInputEditorFocused . set ( hasFocus ) ;
239
242
this . _elements . content . classList . toggle ( 'synthetic-focus' , hasFocus ) ;
240
243
} ;
241
244
this . _store . add ( this . _inputEditor . onDidFocusEditorWidget ( updateFocused ) ) ;
242
245
this . _store . add ( this . _inputEditor . onDidBlurEditorWidget ( updateFocused ) ) ;
246
+ this . _store . add ( toDisposable ( ( ) => {
247
+ this . _ctxInnerCursorFirst . reset ( ) ;
248
+ this . _ctxInnerCursorLast . reset ( ) ;
249
+ this . _ctxInputEditorFocused . reset ( ) ;
250
+ } ) ) ;
243
251
updateFocused ( ) ;
244
252
245
253
// placeholder
@@ -474,6 +482,10 @@ export class InteractiveEditorWidget {
474
482
475
483
reset ( ) {
476
484
this . _ctxInputEmpty . reset ( ) ;
485
+ this . _ctxInnerCursorFirst . reset ( ) ;
486
+ this . _ctxInnerCursorLast . reset ( ) ;
487
+ this . _ctxInputEditorFocused . reset ( ) ;
488
+
477
489
this . value = '' ;
478
490
this . updateMarkdownMessage ( undefined ) ;
479
491
0 commit comments