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
+111
View File
@@ -1094,6 +1094,11 @@
width: min(1180px, calc(100vw - 32px));
height: min(840px, calc(100vh - 32px));
}
.line-patch-dialog {
grid-template-rows: auto minmax(0, 1fr);
width: min(1320px, calc(100vw - 32px));
height: min(860px, calc(100vh - 32px));
}
.compare-select-dialog {
display: block;
width: min(720px, calc(100vw - 32px));
@@ -1311,6 +1316,112 @@
.prepared-tag { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; color: #4eca76; font-size: 12px; font-weight: 700; }
.line-patch-body {
display: grid;
grid-template-rows: minmax(0, 1fr);
min-height: 0;
overflow: hidden;
}
.line-patch-scroll {
min-height: 0;
overflow: auto;
background: #0b0b14;
}
.line-patch-hunk {
border-bottom: 1px solid var(--color-border-subtle);
}
.line-patch-hunk-head {
position: sticky;
top: 0;
left: 0;
z-index: 1;
display: flex;
align-items: center;
justify-content: flex-start;
gap: 12px;
width: max-content;
min-width: 100%;
padding: 7px 10px;
border-bottom: 1px solid var(--color-border-subtle);
background: rgba(20, 22, 36, 0.96);
}
.line-patch-hunk-head code {
color: var(--color-accent);
font-family: var(--font-mono);
font-size: 12px;
white-space: pre;
}
.line-patch-hunk-actions {
display: flex;
align-items: center;
gap: 6px;
flex: 0 0 auto;
padding-left: 16px;
}
.line-patch-hunk-button {
min-height: 22px;
padding: 0 8px;
border: 1px solid var(--color-border-subtle);
border-radius: 3px;
background: rgba(255, 255, 255, 0.03);
color: var(--color-ink);
font-size: 12px;
font-weight: 700;
line-height: 1;
}
.line-patch-hunk-button:hover:not(:disabled) {
background: rgba(255, 255, 255, 0.08);
}
.line-patch-hunk-button.discard {
border-color: rgba(255, 90, 103, 0.7);
color: #ffccd1;
}
.line-patch-hunk-button.stage,
.line-patch-hunk-button.unstage {
border-color: rgba(78, 202, 118, 0.72);
color: #bff1ce;
}
.line-patch-lines {
min-width: max-content;
font-family: var(--font-mono);
font-size: 12px;
}
.line-patch-row {
display: grid;
grid-template-columns: 22px minmax(max-content, 1fr);
align-items: start;
min-height: 22px;
padding: 1px 10px 1px 28px;
color: var(--color-ink-muted);
}
.line-patch-row.add {
background: rgba(78, 202, 118, 0.09);
color: #bff1ce;
}
.line-patch-row.delete {
background: rgba(255, 90, 103, 0.1);
color: #ffccd1;
}
.line-patch-row.meta {
color: var(--color-ink-faint);
}
.line-patch-prefix {
color: var(--color-ink-faint);
text-align: center;
user-select: none;
}
.line-patch-row.add .line-patch-prefix { color: #4eca76; }
.line-patch-row.delete .line-patch-prefix { color: #ff6b7a; }
.line-patch-row code {
white-space: pre;
font-family: var(--font-mono);
}
.global-search-body {
display: grid;
grid-template-rows: auto auto minmax(0, 1fr);