Implement interactive hunk staging and discarding

Introduce a new dialog that allows users to view file changes as individual hunks and selectively stage, unstage, or discard them. This provides more granular control over modifications, similar to `git add -p`.

Enhance branch panel usability by allowing double-click to checkout a branch.
This commit is contained in:
Christoph Brandau
2026-07-01 14:47:36 +02:00
parent 0bbd5ce1e8
commit 5752243e6e
9 changed files with 636 additions and 11 deletions
+19 -2
View File
@@ -50,6 +50,13 @@
createOpen = false;
localOpen = true;
}
function checkoutOnDoubleClick(event: MouseEvent, branch: GitBranchInfo) {
if (branch.current || isBusy) return;
const target = event.target instanceof HTMLElement ? event.target : null;
if (target?.closest("button")) return;
onCheckout(branch);
}
</script>
<section class="panel grid grid-rows-[auto_1fr] overflow-hidden" aria-label="Branches">
@@ -121,7 +128,12 @@
<div class="branch-empty">No local branches.</div>
{:else}
{#each localBranches as branch (branch.name)}
<article class="branch-row" class:current={branch.current}>
<article
class="branch-row"
class:current={branch.current}
ondblclick={(event) => checkoutOnDoubleClick(event, branch)}
title={branch.current ? "Current branch" : "Double-click to checkout"}
>
<div class="branch-info">
<GitBranch size={16} aria-hidden="true" />
<div>
@@ -169,7 +181,12 @@
<div class="branch-empty">No remote branches.</div>
{:else}
{#each remoteBranches as branch (branch.name)}
<article class="branch-row" class:current={branch.current}>
<article
class="branch-row"
class:current={branch.current}
ondblclick={(event) => checkoutOnDoubleClick(event, branch)}
title={branch.current ? "Current branch" : "Double-click to checkout"}
>
<div class="branch-info">
<GitBranch size={16} aria-hidden="true" />
<div>