@@ -327,6 +327,18 @@ function removeSearch() {
327327 $footer . removeAttribute ( "data-searching" ) ;
328328 $searchRow1 . remove ( ) ;
329329 $searchRow2 . remove ( ) ;
330+ const { activeFile } = editorManager ;
331+
332+ // Check if current tab is a terminal
333+ if (
334+ activeFile &&
335+ activeFile . type === "terminal" &&
336+ activeFile . terminalComponent
337+ ) {
338+ activeFile . terminalComponent . searchAddon ?. clearDecorations ( ) ;
339+ activeFile . terminalComponent . searchAddon ?. clearActiveDecoration ( ) ;
340+ return ;
341+ }
330342 focusEditor ( ) ;
331343}
332344
@@ -337,20 +349,44 @@ function removeSearch() {
337349 */
338350function find ( skip , backward ) {
339351 const { $searchInput } = quickTools ;
340- editorManager . editor . find ( $searchInput . value , {
341- skipCurrent : skip ,
342- ...appSettings . value . search ,
343- backwards : backward ,
344- } ) ;
352+ const { activeFile } = editorManager ;
353+
354+ // Check if current tab is a terminal
355+ if (
356+ activeFile &&
357+ activeFile . type === "terminal" &&
358+ activeFile . terminalComponent
359+ ) {
360+ activeFile . terminalComponent . search ( $searchInput . value , skip , backward ) ;
361+ } else {
362+ // Use ACE editor search for regular files
363+ editorManager . editor . find ( $searchInput . value , {
364+ skipCurrent : skip ,
365+ ...appSettings . value . search ,
366+ backwards : backward ,
367+ } ) ;
368+ }
345369
346370 updateSearchState ( ) ;
347371}
348372
349373function updateSearchState ( ) {
350374 const MAX_COUNT = 999 ;
351- const { editor } = editorManager ;
375+ const { activeFile } = editorManager ;
352376 const { $searchPos, $searchTotal } = quickTools ;
353377
378+ // Check if current tab is a terminal
379+ if ( activeFile && activeFile . type === "terminal" ) {
380+ // For terminal, we can't easily count all matches like in ACE editor
381+ // xterm search addon doesn't provide this information
382+ // So we just show a generic indicator
383+ $searchTotal . textContent = "?" ;
384+ $searchPos . textContent = "?" ;
385+ return ;
386+ }
387+
388+ // Use ACE editor search state for regular files
389+ const { editor } = editorManager ;
354390 let regex = editor . $search . $options . re ;
355391 let all = 0 ;
356392 let before = 0 ;
0 commit comments