Skip to content

Commit 8e648e0

Browse files
ozgesolidkeyclaude
andcommitted
Fix folder search navigation and add visible filter status badge
Navigation fix (root causes, not workarounds): - Same file + filter active: clear filter then navigateTo — no re-open - File in another tab: switchToTab, clear any restored filter, navigateTo - File not open: loadFile (clears filter on fresh open) then navigateTo - Replaced goToLine (sync, no cache warming) with navigateTo (async, pre-warms cache before scroll — eliminates blank-line flash) Filter indicator: - Status bar now shows a yellow "⊘ Filtered: N lines" pill when a filter is active, with an × button to clear it immediately - Replaces the subtle "(N filtered)" text that was easy to miss Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 2b2268b commit 8e648e0

3 files changed

Lines changed: 58 additions & 10 deletions

File tree

src/renderer/index.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -681,7 +681,13 @@ <h2>LOGAN</h2>
681681
<span id="status-file">No file</span>
682682
<span class="status-separator">|</span>
683683
<span id="status-lines">0 lines</span>
684-
<span id="status-filtered" class="hidden">(<span id="filtered-count">0</span> filtered)</span>
684+
<span id="status-filtered" class="status-filter-badge hidden" title="A filter is active — click to clear">
685+
<span class="status-filter-icon"></span>
686+
<span>Filtered:</span>
687+
<span id="filtered-count">0</span>
688+
<span>lines</span>
689+
<button id="btn-status-clear-filter" class="status-filter-clear" title="Clear filter">×</button>
690+
</span>
685691
</div>
686692
<div class="status-center">
687693
<div id="progress-container" class="progress-container hidden">

src/renderer/renderer.ts

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4742,16 +4742,29 @@ function renderFolderSearchResults(pattern: string, cancelled?: boolean): void {
47424742
item.addEventListener('click', async () => {
47434743
const index = parseInt((item as HTMLElement).dataset.index || '0', 10);
47444744
const match = state.folderSearchResults[index];
4745-
if (match) {
4746-
await loadFile(match.filePath);
4747-
// If a filter is active (restored from tab state), clear it so the
4748-
// absolute line number from ripgrep maps correctly to a display index.
4749-
if (state.isFiltered) {
4750-
await clearFilter();
4751-
}
4752-
goToLine(match.lineNumber - 1); // match.lineNumber is 1-based from ripgrep
4753-
renderVisibleLines();
4745+
if (!match) return;
4746+
4747+
const absLine = match.lineNumber - 1; // ripgrep is 1-based → 0-based
4748+
4749+
// Same file already open in current tab — just clear filter and navigate
4750+
if (match.filePath === state.filePath) {
4751+
if (state.isFiltered) await clearFilter();
4752+
await navigateTo(absLine);
4753+
return;
47544754
}
4755+
4756+
// File open in another tab — switch to it, clear any restored filter, navigate
4757+
const existingTab = findTabByFilePath(match.filePath);
4758+
if (existingTab) {
4759+
await switchToTab(existingTab.id);
4760+
if (state.isFiltered) await clearFilter();
4761+
await navigateTo(absLine);
4762+
return;
4763+
}
4764+
4765+
// File not open — load fresh (loadFile clears filter + pre-warms cache)
4766+
await loadFile(match.filePath);
4767+
await navigateTo(absLine);
47554768
});
47564769
});
47574770
}
@@ -14003,6 +14016,7 @@ function init(): void {
1400314016
elements.btnFilter.addEventListener('click', showFilterModal);
1400414017
elements.btnApplyFilter.addEventListener('click', () => applyFilter());
1400514018
elements.btnClearFilter.addEventListener('click', clearFilter);
14019+
document.getElementById('btn-status-clear-filter')?.addEventListener('click', clearFilter);
1400614020
elements.btnAddIncludePattern.addEventListener('click', () => addIncludePatternRow());
1400714021

1400814022
// Advanced Filter

src/renderer/styles.css

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,34 @@ body.platform-darwin .titlebar {
25862586
color: rgba(255, 255, 255, 0.5);
25872587
}
25882588

2589+
/* Filter active badge in status bar */
2590+
.status-filter-badge {
2591+
display: inline-flex;
2592+
align-items: center;
2593+
gap: 4px;
2594+
background: rgba(255, 184, 64, 0.18);
2595+
border: 1px solid rgba(255, 184, 64, 0.45);
2596+
color: #ffb840;
2597+
border-radius: 10px;
2598+
padding: 1px 6px 1px 5px;
2599+
font-size: 11px;
2600+
font-weight: 500;
2601+
cursor: default;
2602+
}
2603+
.status-filter-badge.hidden { display: none; }
2604+
.status-filter-icon { font-size: 10px; opacity: 0.8; }
2605+
.status-filter-clear {
2606+
background: none;
2607+
border: none;
2608+
color: #ffb840;
2609+
cursor: pointer;
2610+
font-size: 13px;
2611+
line-height: 1;
2612+
padding: 0 0 0 2px;
2613+
opacity: 0.7;
2614+
}
2615+
.status-filter-clear:hover { opacity: 1; }
2616+
25892617
.progress-container {
25902618
display: flex;
25912619
align-items: center;

0 commit comments

Comments
 (0)