@@ -126,12 +126,10 @@ export class TerminalVoiceSession extends Disposable {
126
126
this . _acceptTranscriptionScheduler ! . cancel ( ) ;
127
127
this . _sendText ( ) ;
128
128
}
129
- this . _marker ?. dispose ( ) ;
130
- this . _ghostTextMarker ?. dispose ( ) ;
131
- this . _ghostText ?. dispose ( ) ;
132
129
this . _ghostText = undefined ;
133
- this . _decoration ?. dispose ( ) ;
134
130
this . _decoration = undefined ;
131
+ this . _marker = undefined ;
132
+ this . _ghostTextMarker = undefined ;
135
133
this . _cancellationTokenSource ?. cancel ( ) ;
136
134
this . _disposables . clear ( ) ;
137
135
this . _input = '' ;
@@ -163,11 +161,15 @@ export class TerminalVoiceSession extends Disposable {
163
161
if ( ! this . _marker ) {
164
162
return ;
165
163
}
164
+ this . _disposables . add ( this . _marker ) ;
166
165
this . _decoration = xterm . registerDecoration ( {
167
166
marker : this . _marker ,
168
167
layer : 'top' ,
169
168
x : xterm . buffer . active . cursorX ?? 0 ,
170
169
} ) ;
170
+ if ( this . _decoration ) {
171
+ this . _disposables . add ( this . _decoration ) ;
172
+ }
171
173
this . _decoration ?. onRender ( ( e : HTMLElement ) => {
172
174
e . classList . add ( ...ThemeIcon . asClassNameArray ( Codicon . micFilled ) , 'terminal-voice' , 'recording' ) ;
173
175
e . style . transform = onFirstLine ? 'translate(10px, -2px)' : 'translate(-6px, -5px)' ;
@@ -193,12 +195,16 @@ export class TerminalVoiceSession extends Disposable {
193
195
if ( ! this . _ghostTextMarker ) {
194
196
return ;
195
197
}
198
+ this . _disposables . add ( this . _ghostTextMarker ) ;
196
199
const onFirstLine = xterm . buffer . active . cursorY === 0 ;
197
200
this . _ghostText = xterm . registerDecoration ( {
198
201
marker : this . _ghostTextMarker ,
199
202
layer : 'top' ,
200
203
x : onFirstLine ? xterm . buffer . active . cursorX + 4 : xterm . buffer . active . cursorX + 1 ,
201
204
} ) ;
205
+ if ( this . _ghostText ) {
206
+ this . _disposables . add ( this . _ghostText ) ;
207
+ }
202
208
this . _ghostText ?. onRender ( ( e : HTMLElement ) => {
203
209
e . classList . add ( 'terminal-voice-progress-text' ) ;
204
210
e . textContent = text ;
0 commit comments