@@ -9,7 +9,7 @@ import * as dom from 'vs/base/browser/dom';
9
9
import { Button } from 'vs/base/browser/ui/button/button' ;
10
10
import { Codicon } from 'vs/base/common/codicons' ;
11
11
import { Emitter } from 'vs/base/common/event' ;
12
- import { Disposable } from 'vs/base/common/lifecycle' ;
12
+ import { Disposable , DisposableStore } from 'vs/base/common/lifecycle' ;
13
13
import { Schemas } from 'vs/base/common/network' ;
14
14
import { URI , UriComponents } from 'vs/base/common/uri' ;
15
15
import { IEditorConstructionOptions } from 'vs/editor/browser/config/editorConfiguration' ;
@@ -124,6 +124,8 @@ export class CodeBlockPart extends Disposable {
124
124
private currentCodeBlockData : ICodeBlockData | undefined ;
125
125
private currentScrollWidth = 0 ;
126
126
127
+ private disposableStore = this . _register ( new DisposableStore ( ) ) ;
128
+
127
129
constructor (
128
130
private readonly options : ChatEditorOptions ,
129
131
readonly menuId : MenuId ,
@@ -336,8 +338,9 @@ export class CodeBlockPart extends Disposable {
336
338
337
339
this . layout ( width ) ;
338
340
if ( editable ) {
339
- this . _register ( this . editor . onDidFocusEditorWidget ( ( ) => TabFocus . setTabFocusMode ( true ) ) ) ;
340
- this . _register ( this . editor . onDidBlurEditorWidget ( ( ) => TabFocus . setTabFocusMode ( false ) ) ) ;
341
+ this . disposableStore . clear ( ) ;
342
+ this . disposableStore . add ( this . editor . onDidFocusEditorWidget ( ( ) => TabFocus . setTabFocusMode ( true ) ) ) ;
343
+ this . disposableStore . add ( this . editor . onDidBlurEditorWidget ( ( ) => TabFocus . setTabFocusMode ( false ) ) ) ;
341
344
}
342
345
this . editor . updateOptions ( { ariaLabel : localize ( 'chat.codeBlockLabel' , "Code block {0}" , data . codeBlockIndex + 1 ) , readOnly : ! editable } ) ;
343
346
0 commit comments