You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(graph): add jump-to-HEAD button and HEAD search matching (#56)
Add a location button beside the search box that scrolls the graph to
the current HEAD commit, emphasized only when HEAD is off-screen. Also
match the HEAD keyword in search so typing HEAD navigates to it.
Copy file name to clipboardExpand all lines: webview-ui/src/App.svelte
+9-1Lines changed: 9 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -54,6 +54,8 @@ import AmendModal from './components/modals/AmendModal.svelte';
54
54
let bisectMessage =$state<string|null>(null);
55
55
let searchMatchedHashes =$state<Set<string> |null>(null);
56
56
let searchNavigateHash =$state<string|null>(null);
57
+
let headOffscreen =$state(false);
58
+
let headJumpNonce =$state(0);
57
59
let remoteFilter =$state<string[]>([]);
58
60
let branchFilter =$state<string[]>([]);
59
61
let resizing =$state(false);
@@ -279,6 +281,10 @@ import AmendModal from './components/modals/AmendModal.svelte';
279
281
searchNavigateHash=hash;
280
282
}
281
283
284
+
function handleJumpToHead() {
285
+
headJumpNonce++;
286
+
}
287
+
282
288
function handleFilterChange(filter:string[]) {
283
289
remoteFilter=filter;
284
290
if (filter.length>0) {
@@ -448,6 +454,8 @@ import AmendModal from './components/modals/AmendModal.svelte';
448
454
branches={branchStore.branches}
449
455
{branchFilter}
450
456
onBranchFilterChange={handleBranchFilterChange}
457
+
{headOffscreen}
458
+
onJumpToHead={handleJumpToHead}
451
459
/>
452
460
{/if}
453
461
{#ifbisectMessage}
@@ -460,7 +468,7 @@ import AmendModal from './components/modals/AmendModal.svelte';
460
468
{/if}
461
469
{#if!uiStore.commitDetailFullscreen}
462
470
<divclass="graph-area">
463
-
<CommitGraph {searchMatchedHashes} {searchNavigateHash} bisectActive={bisectMessage!==null} bisectCulpritHash={bisectMessage?.includes('is the first bad commit') ?bisectMessage.match(/^([a-f0-9]{7,40})/)?.[1] ??null:null} {remoteFilter} />
471
+
<CommitGraph {searchMatchedHashes} {searchNavigateHash} headJumpNonce={headJumpNonce} onHeadOffscreenChange={(v) =>headOffscreen=v} bisectActive={bisectMessage!==null} bisectCulpritHash={bisectMessage?.includes('is the first bad commit') ?bisectMessage.match(/^([a-f0-9]{7,40})/)?.[1] ??null:null} {remoteFilter} />
0 commit comments