@@ -20,7 +20,6 @@ import {
20
20
consumeEvent ,
21
21
createChildElement ,
22
22
deepFreeze ,
23
- destroyWithOutro ,
24
23
dynamicRequire ,
25
24
extname ,
26
25
fixTyped ,
@@ -61,6 +60,7 @@ import {
61
60
openProfile ,
62
61
} from "./profile-properties.js"
63
62
import { cloneDeep , noop } from "lodash-es"
63
+ import { mount , unmount } from "svelte"
64
64
import { BUNDLE } from "../import.js"
65
65
import type { DeepWritable } from "ts-essentials"
66
66
import type { LigaturesAddon } from "@xterm/addon-ligatures"
@@ -258,7 +258,7 @@ export class TerminalView extends ItemView {
258
258
protected readonly focusedScope = new Scope ( )
259
259
#title0 = ""
260
260
#emulator0: TerminalView . EMULATOR | null = null
261
- #find0: FindComponent | null = null
261
+ #find0: ReturnType < typeof FindComponent > | null = null
262
262
#state = TerminalView . State . DEFAULT
263
263
264
264
public constructor (
@@ -303,7 +303,7 @@ export class TerminalView extends ItemView {
303
303
return this . #emulator0
304
304
}
305
305
306
- get #find( ) : FindComponent | null {
306
+ get #find( ) : ReturnType < typeof FindComponent > | null {
307
307
return this . #find0
308
308
}
309
309
@@ -368,8 +368,13 @@ export class TerminalView extends ItemView {
368
368
this . #emulator0 = val
369
369
}
370
370
371
- set #find( val : FindComponent | null ) {
372
- if ( this . #find) { destroyWithOutro ( this . #find) }
371
+ set #find( val : ReturnType < typeof FindComponent > | null ) {
372
+ if ( this . #find) {
373
+ unmount ( this . #find, { outro : true } )
374
+ . catch ( ( error : unknown ) => {
375
+ activeSelf ( this . contentEl ) . console . warn ( error )
376
+ } )
377
+ }
373
378
this . #find0 = val
374
379
}
375
380
@@ -498,7 +503,7 @@ export class TerminalView extends ItemView {
498
503
499
504
this . register ( language . onChangeLanguage . listen ( ( ) => {
500
505
updateView ( context , this )
501
- this . #find?. $set ( { i18n : i18n . t } )
506
+ this . #find?. setI18n ( i18n . t )
502
507
} ) )
503
508
504
509
this . register ( ( ) => { keymap . popScope ( scope ) } )
@@ -564,11 +569,11 @@ export class TerminalView extends ItemView {
564
569
/* @__PURE__ */ activeSelf ( contentEl ) . console . debug ( error )
565
570
empty = true
566
571
}
567
- if ( empty ) { this . #find?. $set ( { results : "" } ) }
572
+ if ( empty ) { this . #find?. setResults ( "" ) }
568
573
} ,
569
574
optional : { anchor ?: Element } = { }
570
575
assignExact ( optional , "anchor" , contentEl . firstElementChild ?? void 0 )
571
- this . #find = new FindComponent ( {
576
+ this . #find = mount ( FindComponent , {
572
577
intro : true ,
573
578
props : {
574
579
i18n : i18n . t ,
@@ -583,8 +588,8 @@ export class TerminalView extends ItemView {
583
588
...optional ,
584
589
} )
585
590
}
586
- // eslint-disable-next-line @typescript-eslint/no-unsafe-call
587
- this . #find[ " focus" ] ( )
591
+
592
+ this . #find. focus ( )
588
593
}
589
594
590
595
protected startEmulator ( focus : boolean ) : void {
@@ -715,7 +720,7 @@ export class TerminalView extends ItemView {
715
720
emulator . reopen ( )
716
721
emulator . resize ( false ) . catch ( warn )
717
722
} ) ,
718
- ( ) => { this . #find?. $set ( { results : "" } ) } ,
723
+ ( ) => { this . #find?. setResults ( "" ) } ,
719
724
) ,
720
725
dragAndDrop : new DragAndDropAddon ( ele ) ,
721
726
ligatures : new LigaturesAddon ( { } ) ,
@@ -747,7 +752,7 @@ export class TerminalView extends ItemView {
747
752
: settings . value . errorNoticeTimeout ,
748
753
context ,
749
754
)
750
- } , error => {
755
+ } , ( error : unknown ) => {
751
756
printError ( anyToError ( error ) , ( ) =>
752
757
i18n . t ( "errors.error-spawning-terminal" ) , context )
753
758
} )
@@ -775,7 +780,7 @@ export class TerminalView extends ItemView {
775
780
index : resultIndex + 1 ,
776
781
} ,
777
782
} )
778
- this . #find?. $set ( { results } )
783
+ this . #find?. setResults ( results )
779
784
} )
780
785
781
786
emulator . resize ( ) . catch ( warn )
0 commit comments