Skip to content

Commit 6a5a0f6

Browse files
committed
feat: search result count and dir double-click propagation
- SearchDialog shows 'X/Y 匹配' between navigation arrows - Shows '无匹配' when no results found - onDirDoubleClick propagated to both FileTree instances in MainContent
1 parent 06b5985 commit 6a5a0f6

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

structure-insight/components/MainContent.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ const MainContent: React.FC<MainContentProps> = ({ logic, codeViewRef, leftPanel
135135
onCopyPath={handlers.handleCopyPath}
136136
wordWrap={state.wordWrap}
137137
onToggleExclude={handlers.handleToggleExclude}
138+
onDirDoubleClick={handlers.handleDirDoubleClick}
138139
selectedFilePath={state.selectedFilePath}
139140
showCharCount={state.showCharCount}
140141
/>
@@ -216,6 +217,7 @@ const MainContent: React.FC<MainContentProps> = ({ logic, codeViewRef, leftPanel
216217
onCopyPath={handlers.handleCopyPath}
217218
wordWrap={state.wordWrap}
218219
onToggleExclude={handlers.handleToggleExclude}
220+
onDirDoubleClick={handlers.handleDirDoubleClick}
219221
selectedFilePath={state.selectedFilePath}
220222
showCharCount={state.showCharCount}
221223
/>

structure-insight/components/SearchDialog.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,14 @@ const SearchDialog: React.FC<SearchDialogProps> = ({ onClose, onSearch, onNaviga
171171
)}
172172
</div>
173173
<button type="button" onClick={() => onNavigate('prev')} disabled={resultsCount === 0} className="w-10 h-10 rounded-md bg-light-bg dark:bg-dark-bg border border-light-border dark:border-dark-border disabled:opacity-50 flex items-center justify-center hover:bg-light-border dark:hover:bg-dark-border/50"><i className="fa-solid fa-arrow-up"></i></button>
174+
{query && resultsCount > 0 && (
175+
<span className="text-xs text-light-subtle-text dark:text-dark-subtle-text whitespace-nowrap">
176+
{currentIndex !== null ? `${currentIndex + 1}/${resultsCount}` : `1/${resultsCount}`} 匹配
177+
</span>
178+
)}
179+
{query && resultsCount === 0 && (
180+
<span className="text-xs text-light-subtle-text dark:text-dark-subtle-text whitespace-nowrap">无匹配</span>
181+
)}
174182
<button type="button" onClick={() => onNavigate('next')} disabled={resultsCount === 0} className="w-10 h-10 rounded-md bg-light-bg dark:bg-dark-bg border border-light-border dark:border-dark-border disabled:opacity-50 flex items-center justify-center hover:bg-light-border dark:hover:bg-dark-border/50"><i className="fa-solid fa-arrow-down"></i></button>
175183
</div>
176184
<div className="flex items-center space-x-2 mt-3">

0 commit comments

Comments
 (0)