dsh-gufa-code 1.3.61 → 1.3.63

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -533,6 +533,7 @@
533
533
  const propsRef = useRef(props)
534
534
  const activePathRef = useRef(activePath)
535
535
  const statusRef = useRef('loading')
536
+ const pendingRevealRef = useRef(null)
536
537
 
537
538
  /** idle → loading → ready / error */
538
539
  const [status, setStatus] = useState('loading')
@@ -970,6 +971,17 @@
970
971
  }
971
972
  }
972
973
  reportCursor()
974
+ const pending = pendingRevealRef.current
975
+ if (pending !== null && pending !== undefined && pending.path === targetTab.path) {
976
+ pendingRevealRef.current = null
977
+ try {
978
+ editor.setPosition({ lineNumber: pending.line, column: pending.column })
979
+ editor.revealLineInCenter(pending.line)
980
+ editor.focus()
981
+ } catch {
982
+ /* ignore */
983
+ }
984
+ }
973
985
  /* 打开/切换文件不抢焦点:只有用户点击编辑区时才进入键盘编辑 */
974
986
  }
975
987
  } else if (targetTab !== null) {
@@ -977,6 +989,31 @@
977
989
  }
978
990
  }, [status, tabs, activePath, root, reportCursor, disposeAllModels, disposeModelAt])
979
991
 
992
+ /* 搜索面板点击结果 → 打开文件并跳到对应行列(由 App 通过 bus 发来) */
993
+ useEffect(() => {
994
+ if (G.bus === null || G.bus === undefined || typeof G.bus.on !== 'function') return undefined
995
+ return G.bus.on('editor:reveal', (detail) => {
996
+ const editor = editorRef.current
997
+ if (editor === null || editor === undefined) return
998
+ const rawLine = Number(detail?.line)
999
+ const rawColumn = Number(detail?.column)
1000
+ const line = Number.isFinite(rawLine) ? Math.max(1, Math.trunc(rawLine)) : 1
1001
+ const column = Number.isFinite(rawColumn) ? Math.max(1, Math.trunc(rawColumn)) : 1
1002
+ const path = typeof detail?.path === 'string' && detail.path !== '' ? detail.path : null
1003
+ if (path !== null && modelPathRef.current !== path) {
1004
+ pendingRevealRef.current = { path, line, column }
1005
+ return
1006
+ }
1007
+ try {
1008
+ editor.setPosition({ lineNumber: line, column })
1009
+ editor.revealLineInCenter(line)
1010
+ editor.focus()
1011
+ } catch (error) {
1012
+ /* ignore */
1013
+ }
1014
+ })
1015
+ }, [])
1016
+
980
1017
  /* ── Git diff 视图:Monaco DiffEditor(未暂存的一侧可编辑并保存) ── */
981
1018
  useEffect(() => {
982
1019
  const disposeDiff = () => {
@@ -510,6 +510,331 @@ G.MenuItem = function MenuItem(props) {
510
510
  )
511
511
  }
512
512
 
513
+ /* ── 全局搜索(左侧「搜索」面板) ──────────────────────────────────────── */
514
+ G.SearchPanel = function SearchPanel(props) {
515
+ const t = G.useT()
516
+ const root = props.root
517
+ const [query, setQuery] = useState('')
518
+ const [caseSensitive, setCaseSensitive] = useState(false)
519
+ const [regex, setRegex] = useState(false)
520
+ const [status, setStatus] = useState('idle')
521
+ const [result, setResult] = useState(null)
522
+ const [error, setError] = useState('')
523
+ const [collapsed, setCollapsed] = useState({})
524
+ const [replaceOpen, setReplaceOpen] = useState(false)
525
+ const [replacement, setReplacement] = useState('')
526
+ const [replacing, setReplacing] = useState(false)
527
+ const [confirming, setConfirming] = useState(null)
528
+ const [replaceError, setReplaceError] = useState('')
529
+ const [notice, setNotice] = useState('')
530
+ const inputRef = useRef(null)
531
+ const requestRef = useRef(0)
532
+
533
+ const focusInput = useCallback(() => {
534
+ const node = inputRef.current
535
+ if (node === null || node === undefined) return
536
+ try {
537
+ node.focus()
538
+ if (typeof node.select === 'function') node.select()
539
+ } catch {
540
+ /* ignore */
541
+ }
542
+ }, [])
543
+
544
+ const runSearch = useCallback(async (value) => {
545
+ const text = String(value ?? '').trim()
546
+ if (text === '' || typeof root !== 'string' || root === '') {
547
+ requestRef.current += 1
548
+ setResult(null)
549
+ setStatus('idle')
550
+ setError('')
551
+ return
552
+ }
553
+ const seq = requestRef.current + 1
554
+ requestRef.current = seq
555
+ setStatus('loading')
556
+ setError('')
557
+ try {
558
+ const value = await G.api('fs.search', {
559
+ root,
560
+ query: text,
561
+ options: { caseSensitive, regex, maxFiles: 200, maxMatches: 500 },
562
+ })
563
+ if (seq !== requestRef.current) return
564
+ setResult(value)
565
+ setStatus('ready')
566
+ } catch (err) {
567
+ if (seq !== requestRef.current) return
568
+ setResult(null)
569
+ setError(G.errorText(err))
570
+ setStatus('error')
571
+ }
572
+ }, [root, caseSensitive, regex])
573
+
574
+ const requestReplace = useCallback((paths, count, files) => {
575
+ if (typeof root !== 'string' || root === '' || query.trim() === '' || replacing) return
576
+ setReplaceError('')
577
+ setNotice('')
578
+ setConfirming({ paths: Array.isArray(paths) ? paths : null, count: Number(count) || 0, files: Number(files) || 0 })
579
+ }, [root, query, replacing])
580
+
581
+ const doReplace = useCallback(async () => {
582
+ const pending = confirming
583
+ if (pending === null || replacing) return
584
+ setConfirming(null)
585
+ setReplacing(true)
586
+ setReplaceError('')
587
+ setNotice('')
588
+ try {
589
+ await props.onBeforeReplace?.()
590
+ const value = await G.api('fs.replace', {
591
+ root,
592
+ query: query.trim(),
593
+ replacement,
594
+ options: { caseSensitive, regex },
595
+ paths: Array.isArray(pending.paths) ? pending.paths : undefined,
596
+ })
597
+ const count = Number(value?.replacedCount) || 0
598
+ const replacedFiles = Array.isArray(value?.replacedFiles) ? value.replacedFiles : []
599
+ setNotice(t('search.replaced', { count, files: replacedFiles.length }))
600
+ await props.onFilesChanged?.(replacedFiles)
601
+ await runSearch(query)
602
+ } catch (error) {
603
+ setReplaceError(G.errorText(error))
604
+ } finally {
605
+ setReplacing(false)
606
+ }
607
+ }, [confirming, replacing, props.onBeforeReplace, props.onFilesChanged, root, query, replacement, caseSensitive, regex, runSearch, t])
608
+
609
+ /* 输入防抖搜索(回车立即搜索) */
610
+ useEffect(() => {
611
+ if (typeof root !== 'string' || root === '') return undefined
612
+ const text = query.trim()
613
+ if (text === '') {
614
+ setResult(null)
615
+ setStatus('idle')
616
+ setError('')
617
+ return undefined
618
+ }
619
+ const timer = window.setTimeout(() => { void runSearch(text) }, 320)
620
+ return () => window.clearTimeout(timer)
621
+ }, [query, runSearch, root])
622
+
623
+ /* 快捷键/按钮打开搜索面板时聚焦输入框 */
624
+ useEffect(() => {
625
+ if (G.bus === null || G.bus === undefined || typeof G.bus.on !== 'function') return undefined
626
+ return G.bus.on('search:focus', focusInput)
627
+ }, [focusInput])
628
+
629
+ useEffect(() => {
630
+ if (props.active === true) focusInput()
631
+ }, [props.active, focusInput])
632
+
633
+ const summary = (() => {
634
+ if (status === 'loading') return t('search.searching')
635
+ if (status === 'error' || result === null) return ''
636
+ if (result.total === 0) return result.truncated === true ? t('search.truncated') : t('search.noResult')
637
+ const base = t('search.summary', { count: result.total, files: result.files.length })
638
+ return result.truncated === true ? `${base} · ${t('search.truncated')}` : base
639
+ })()
640
+
641
+ const highlight = (match) => {
642
+ const text = typeof match.text === 'string' ? match.text : ''
643
+ const start = Number.isFinite(match.start) ? match.start : -1
644
+ const end = Number.isFinite(match.end) ? match.end : -1
645
+ if (start < 0 || end <= start || start >= text.length) return [text]
646
+ const safeEnd = Math.min(end, text.length)
647
+ return [
648
+ text.slice(0, start),
649
+ h('mark', { key: 'hit', className: 'gufa-search-hit' }, text.slice(start, safeEnd)),
650
+ text.slice(safeEnd),
651
+ ]
652
+ }
653
+
654
+ const body = (() => {
655
+ if (typeof root !== 'string' || root === '') {
656
+ return h('div', { className: 'gufa-hint', style: { padding: '10px 12px' } }, t('explorer.openProjectFirst'))
657
+ }
658
+ if (error !== '') {
659
+ return h('div', { className: 'gufa-error-banner', style: { margin: '8px' } }, h(G.Icon, { name: 'warn', size: 12 }), h('span', null, `${t('search.error')}:${error}`))
660
+ }
661
+ if (status === 'idle') return h('div', { className: 'gufa-hint', style: { padding: '10px 12px' } }, t('search.idle'))
662
+ if (status === 'loading') return h('div', { className: 'gufa-hint', style: { padding: '10px 12px', display: 'flex', gap: 8, alignItems: 'center' } }, h(G.Spinner), t('search.searching'))
663
+ if (result === null || result.total === 0) {
664
+ const emptyText = result !== null && result.truncated === true ? t('search.truncated') : t('search.noResult')
665
+ return h('div', { className: 'gufa-hint', style: { padding: '10px 12px' } }, emptyText)
666
+ }
667
+ return h(
668
+ 'div',
669
+ { className: 'gufa-search-results' },
670
+ ...result.files.map((file) => {
671
+ const isCollapsed = collapsed[file.path] === true
672
+ return h(
673
+ 'div',
674
+ { key: file.path, className: 'gufa-search-file' },
675
+ h(
676
+ 'button',
677
+ {
678
+ type: 'button',
679
+ className: 'gufa-search-file-head',
680
+ title: file.path,
681
+ onClick: () => setCollapsed((current) => ({ ...current, [file.path]: !isCollapsed })),
682
+ },
683
+ h(G.Icon, { name: isCollapsed ? 'chevron-right' : 'chevron-down', size: 11 }),
684
+ h('span', { className: 'gufa-search-file-name' }, G.basename(file.path)),
685
+ h('span', { className: 'gufa-search-file-dir' }, G.dirname(file.path)),
686
+ h('span', { className: 'gufa-search-file-count' }, String(file.matches.length)),
687
+ replaceOpen
688
+ ? h(
689
+ 'span',
690
+ {
691
+ className: 'gufa-search-file-replace',
692
+ title: t('search.replaceThisFile'),
693
+ role: 'button',
694
+ onClick: (event) => {
695
+ event.stopPropagation()
696
+ event.preventDefault()
697
+ requestReplace([file.path], file.matches.length, 1)
698
+ },
699
+ },
700
+ h(G.Icon, { name: 'pencil', size: 11 }),
701
+ )
702
+ : null,
703
+ ),
704
+ isCollapsed
705
+ ? null
706
+ : file.matches.map((match, index) =>
707
+ h(
708
+ 'button',
709
+ {
710
+ key: `${file.path}:${match.line}:${match.column}:${index}`,
711
+ type: 'button',
712
+ className: 'gufa-search-match',
713
+ title: `${file.path}:${match.line}:${match.column}`,
714
+ onClick: () => props.onOpenFile?.(file.path, match.line, match.column),
715
+ },
716
+ h('span', { className: 'gufa-search-line' }, String(match.line)),
717
+ h('span', { className: 'gufa-search-text' }, ...highlight(match)),
718
+ ),
719
+ ),
720
+ )
721
+ }),
722
+ )
723
+ })()
724
+
725
+ return h(
726
+ 'div',
727
+ { className: 'gufa-search-panel', style: { display: 'flex', flexDirection: 'column', flex: '1 1 auto', minHeight: 0 } },
728
+ h('div', { className: 'gufa-panel-head' }, h('span', { className: 'gufa-panel-head-title' }, t('activity.search'))),
729
+ h(
730
+ 'div',
731
+ { className: 'gufa-search-bar' },
732
+ h(
733
+ 'div',
734
+ { className: 'gufa-search-input-wrap' },
735
+ h(G.Icon, { name: 'search', size: 13 }),
736
+ h('input', {
737
+ ref: inputRef,
738
+ className: 'gufa-search-input',
739
+ type: 'text',
740
+ value: query,
741
+ placeholder: t('search.placeholder'),
742
+ spellCheck: false,
743
+ onChange: (event) => setQuery(event.target.value),
744
+ onKeyDown: (event) => {
745
+ if (event.key === 'Enter') {
746
+ event.preventDefault()
747
+ void runSearch(query)
748
+ } else if (event.key === 'Escape') {
749
+ event.preventDefault()
750
+ setQuery('')
751
+ inputRef.current?.blur?.()
752
+ }
753
+ },
754
+ }),
755
+ query === ''
756
+ ? null
757
+ : h(G.IconButton, { title: t('search.clear'), onClick: () => { setQuery(''); focusInput() } }, h(G.Icon, { name: 'close', size: 11 })),
758
+ h(G.IconButton, { title: t('search.replaceToggle'), onClick: () => setReplaceOpen((value) => !value) }, h(G.Icon, { name: replaceOpen ? 'chevron-up' : 'chevron-down', size: 12 })),
759
+ ),
760
+ h(
761
+ 'div',
762
+ { className: 'gufa-search-toggles' },
763
+ h('button', {
764
+ type: 'button',
765
+ className: 'gufa-search-toggle',
766
+ 'data-active': caseSensitive ? '' : undefined,
767
+ title: t('search.caseSensitive'),
768
+ onClick: () => setCaseSensitive((value) => !value),
769
+ }, 'Aa'),
770
+ h('button', {
771
+ type: 'button',
772
+ className: 'gufa-search-toggle',
773
+ 'data-active': regex ? '' : undefined,
774
+ title: t('search.regex'),
775
+ onClick: () => setRegex((value) => !value),
776
+ }, '.*'),
777
+ h('span', { className: 'gufa-search-summary', title: summary }, summary),
778
+ ),
779
+ replaceOpen
780
+ ? h(
781
+ React.Fragment,
782
+ null,
783
+ h(
784
+ 'div',
785
+ { className: 'gufa-search-input-wrap gufa-search-replace-row' },
786
+ h(G.Icon, { name: 'pencil', size: 12 }),
787
+ h('input', {
788
+ className: 'gufa-search-input',
789
+ type: 'text',
790
+ value: replacement,
791
+ placeholder: t('search.replacePlaceholder'),
792
+ spellCheck: false,
793
+ onChange: (event) => setReplacement(event.target.value),
794
+ onKeyDown: (event) => {
795
+ if (event.key !== 'Enter') return
796
+ event.preventDefault()
797
+ requestReplace(null, result?.total ?? 0, result?.files?.length ?? 0)
798
+ },
799
+ }),
800
+ ),
801
+ h(
802
+ 'div',
803
+ { className: 'gufa-search-actions' },
804
+ h(
805
+ 'button',
806
+ {
807
+ type: 'button',
808
+ className: 'gufa-search-action',
809
+ 'data-primary': '',
810
+ disabled: replacing || result === null || result.total === 0,
811
+ onClick: () => requestReplace(null, result?.total ?? 0, result?.files?.length ?? 0),
812
+ },
813
+ replacing ? t('search.replacing') : t('search.replaceAll'),
814
+ ),
815
+ ),
816
+ )
817
+ : null,
818
+ confirming !== null
819
+ ? h(
820
+ 'div',
821
+ { className: 'gufa-search-confirm' },
822
+ h('div', null, t('search.confirmReplace', { count: confirming.count, files: confirming.files })),
823
+ h(
824
+ 'div',
825
+ { className: 'gufa-search-confirm-actions' },
826
+ h('button', { type: 'button', className: 'gufa-search-action', onClick: () => setConfirming(null) }, t('search.confirmNo')),
827
+ h('button', { type: 'button', className: 'gufa-search-action', 'data-primary': '', onClick: () => void doReplace() }, t('search.confirmYes')),
828
+ ),
829
+ )
830
+ : null,
831
+ notice !== '' ? h('div', { className: 'gufa-search-notice' }, notice) : null,
832
+ replaceError !== '' ? h('div', { className: 'gufa-search-error' }, `${t('search.replaceError')}:${replaceError}`) : null,
833
+ ),
834
+ h('div', { className: 'gufa-panel-body gufa-scroll' }, body),
835
+ )
836
+ }
837
+
513
838
  /* ── 源代码管理(Git) ─────────────────────────────────────────────────── */
514
839
  G.GitPanel = function GitPanel(props) {
515
840
  const t = G.useT()
@@ -46,6 +46,7 @@ G.shortcutAction = function shortcutAction(event) {
46
46
  }
47
47
  if (event.shiftKey === true) {
48
48
  if (key === 'e') return 'panelExplorer'
49
+ if (key === 'f') return 'panelSearch'
49
50
  if (key === 'g') return 'panelGit'
50
51
  if (key === 'h' || key === 'u') return 'panelSsh'
51
52
  if (key === 'b') return 'toggleSidebar'
@@ -160,6 +161,7 @@ const GUFA_SHORTCUT_COMMANDS = [
160
161
  { action: 'toggleSidebar', id: 'gufa.ide.toggleSidebar', labelKey: 'shortcuts.toggleSidebar', code: 'KeyB', modifiers: ['primary', 'shift'], regions: ['page', 'editable'] },
161
162
  { action: 'closeTab', id: 'gufa.ide.closeTab', labelKey: 'shortcuts.closeTab', code: 'KeyW', modifiers: ['primary', 'shift'], regions: ['page', 'editable'] },
162
163
  { action: 'panelExplorer', id: 'gufa.ide.panelExplorer', labelKey: 'shortcuts.explorer', code: 'KeyE', modifiers: ['primary', 'shift'], regions: ['page', 'editable'] },
164
+ { action: 'panelSearch', id: 'gufa.ide.panelSearch', labelKey: 'shortcuts.search', code: 'KeyF', modifiers: ['primary', 'shift'], regions: ['page', 'editable'] },
163
165
  { action: 'panelGit', id: 'gufa.ide.panelGit', labelKey: 'shortcuts.git', code: 'KeyG', modifiers: ['primary', 'shift'], regions: ['page', 'editable'] },
164
166
  { action: 'panelSsh', id: 'gufa.ide.panelSsh', labelKey: 'shortcuts.ssh', code: 'KeyU', modifiers: ['primary', 'shift'], regions: ['page', 'editable'] },
165
167
  { action: 'newTerminal', id: 'gufa.ide.newTerminal', labelKey: 'shortcuts.newTerminal', code: 'Backquote', modifiers: ['control', 'shift'], regions: ['page', 'editable', 'terminal'] },
@@ -480,6 +482,7 @@ G.SHORTCUTS = [
480
482
  { action: 'toggleSidebar', labelKey: 'shortcuts.toggleSidebar', keys: ['B'], shift: false },
481
483
  { action: 'closeTab', labelKey: 'shortcuts.closeTab', keys: ['W'], shift: false },
482
484
  { action: 'panelExplorer', labelKey: 'shortcuts.explorer', keys: ['E'], shift: true },
485
+ { action: 'panelSearch', labelKey: 'shortcuts.search', keys: ['F'], shift: true },
483
486
  { action: 'panelGit', labelKey: 'shortcuts.git', keys: ['G'], shift: true },
484
487
  { action: 'panelSsh', labelKey: 'shortcuts.ssh', keys: ['U'], shift: true },
485
488
  { action: 'newTerminal', labelKey: 'shortcuts.newTerminal', keys: ['`'], shift: true, macText: '⌃⇧`', otherText: 'Ctrl+Shift+`' },
@@ -477,6 +477,21 @@ G.GufaApp = function GufaApp(props) {
477
477
  }
478
478
  }, [project, tabs])
479
479
 
480
+ /* 从搜索/定位结果打开文件并跳到指定行列(等 tab 切换完成后再触发编辑器 reveal) */
481
+ const openFileAt = useCallback(async (path, line, column) => {
482
+ if (typeof path !== 'string' || path === '') return
483
+ await openFile(path)
484
+ const targetLine = Number.isFinite(Number(line)) ? Math.max(1, Math.trunc(Number(line))) : 1
485
+ const targetColumn = Number.isFinite(Number(column)) ? Math.max(1, Math.trunc(Number(column))) : 1
486
+ window.setTimeout(() => {
487
+ try {
488
+ G.bus.emit('editor:reveal', { path, line: targetLine, column: targetColumn })
489
+ } catch {
490
+ /* ignore */
491
+ }
492
+ }, 120)
493
+ }, [openFile])
494
+
480
495
  /* 原子恢复标签集合:按快照顺序、去重、最后激活指定文件(避免 openFile 并发产生重复标签) */
481
496
  const applyTabs = useCallback(async (paths, active) => {
482
497
  if (project === null || !Array.isArray(paths)) return
@@ -593,6 +608,49 @@ G.GufaApp = function GufaApp(props) {
593
608
  }
594
609
  }, [project, patchTab, refreshGit, t])
595
610
 
611
+ /* 搜索面板批量替换前:先把所有未落盘的编辑器缓冲保存掉,避免磁盘旧内容覆盖用户输入 */
612
+ const beforeSearchReplace = useCallback(async () => {
613
+ flushBuffersRef.current?.()
614
+ const pending = new Set(editorBuffersRef.current.keys())
615
+ for (const tab of tabsRef.current ?? []) {
616
+ if (tab !== null && tab !== undefined && tab.dirty === true) pending.add(tab.path)
617
+ }
618
+ for (const path of pending) {
619
+ try {
620
+ await saveFile(path)
621
+ } catch {
622
+ /* 单个保存失败不阻断替换 */
623
+ }
624
+ }
625
+ }, [saveFile])
626
+
627
+ /* 搜索面板替换完成后:刷新目录/Git,并把已打开标签同步成磁盘最新内容 */
628
+ const onSearchFilesChanged = useCallback(async (paths) => {
629
+ if (project !== null && Array.isArray(paths) && paths.length > 0) {
630
+ for (const path of paths.slice(0, 30)) {
631
+ const tab = (tabsRef.current ?? []).find((item) => item !== null && item !== undefined && item.path === path)
632
+ if (tab === undefined) continue
633
+ try {
634
+ const doc = await G.api('fs.read', { root: project.root, path })
635
+ editorBuffersRef.current.delete(path)
636
+ patchTab(path, {
637
+ content: doc.content,
638
+ revision: doc.revision,
639
+ savedRevision: doc.revision,
640
+ savedContent: doc.content,
641
+ dirty: false,
642
+ size: doc.size,
643
+ })
644
+ } catch {
645
+ /* 文件已被删除:忽略 */
646
+ }
647
+ }
648
+ }
649
+ setRefreshToken((token) => token + 1)
650
+ setGitRefreshToken((token) => token + 1)
651
+ void refreshGit()
652
+ }, [project, patchTab, refreshGit])
653
+
596
654
  /** 顶栏提示:错误常驻红色;成功用绿色 toast,1.2 秒后自动消失。 */
597
655
  const successTimerRef = useRef(null)
598
656
  const showBanner = useCallback((text, tone) => {
@@ -1977,6 +2035,10 @@ G.GufaApp = function GufaApp(props) {
1977
2035
  if (activePath !== null) closeTabWithConfirm(activePath)
1978
2036
  },
1979
2037
  panelExplorer: () => patchUi({ view: 'explorer', sidebarOpen: true }),
2038
+ panelSearch: () => {
2039
+ patchUi({ view: 'search', sidebarOpen: true })
2040
+ window.setTimeout(() => { G.bus.emit('search:focus') }, 0)
2041
+ },
1980
2042
  panelGit: () => {
1981
2043
  patchUi({ view: 'git', sidebarOpen: true })
1982
2044
  setGitRefreshToken((token) => token + 1)
@@ -2084,6 +2146,7 @@ G.GufaApp = function GufaApp(props) {
2084
2146
  /* ── 渲染 ─────────────────────────────────────────────────────────── */
2085
2147
  const activityItems = [
2086
2148
  { id: 'explorer', icon: 'files', label: t('activity.explorer'), onClick: () => patchUi({ view: 'explorer', sidebarOpen: true }) },
2149
+ { id: 'search', icon: 'search', label: t('activity.search'), onClick: () => { patchUi({ view: 'search', sidebarOpen: true }); G.bus.emit('search:focus') } },
2087
2150
  { id: 'git', icon: 'git', label: t('activity.git'), badge: gitStatus?.changes?.length ?? 0, onClick: () => { patchUi({ view: 'git', sidebarOpen: true }); setGitRefreshToken((token) => token + 1) } },
2088
2151
  { id: 'ssh', icon: 'server', label: t('activity.ssh'), onClick: () => { patchUi({ view: 'ssh', sidebarOpen: true }); setSshRefreshToken((token) => token + 1) } },
2089
2152
  { id: 'terminal', icon: 'terminal', label: t('activity.terminal'), active: ui.terminalOpen, onClick: () => patchUi({ terminalOpen: !ui.terminalOpen }) },
@@ -2110,6 +2173,14 @@ G.GufaApp = function GufaApp(props) {
2110
2173
  onRename: (path) => setModal({ type: 'rename', path }),
2111
2174
  onDelete: (path) => void deleteEntry(path),
2112
2175
  })),
2176
+ h('div', { key: 'search', style: { display: ui.view === 'search' ? 'flex' : 'none', flex: '1 1 auto', minHeight: 0, flexDirection: 'column' } },
2177
+ h(G.SearchPanel, {
2178
+ root: project?.root ?? null,
2179
+ active: ui.view === 'search',
2180
+ onOpenFile: (path, line, column) => void openFileAt(path, line, column),
2181
+ onBeforeReplace: beforeSearchReplace,
2182
+ onFilesChanged: onSearchFilesChanged,
2183
+ })),
2113
2184
  h('div', { key: 'git', style: { display: ui.view === 'git' ? 'flex' : 'none', flex: '1 1 auto', minHeight: 0, flexDirection: 'column' } },
2114
2185
  h(G.GitPanel, {
2115
2186
  root: project?.root ?? null,