Skip to content

Commit ca2f0b4

Browse files
ymansurozerclaude
andauthored
fix: keep the accept/reject bar directly under its hunk when a comment shares the line (#15)
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent dfc077e commit ca2f0b4

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

src/ui/annotations.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { render } from "./render";
99
import type { AnnotationInput, AnnotationMeta, ThreadMeta, ReviewComment } from "./types";
1010

1111
export function annotations(): AnnotationInput[] {
12-
const out: AnnotationInput[] = [];
12+
const threads: AnnotationInput[] = [];
1313
const seen = new Set<string>();
1414
const groups = new Map<string, ReviewComment[]>();
1515
for (const c of currentComments()) {
@@ -36,7 +36,7 @@ export function annotations(): AnnotationInput[] {
3636
if (change) seen.add(change.id);
3737
// The annotation goes to @pierre in DISPLAY coordinates (it matches rendered gutter
3838
// numbers); the metadata keeps the raw line so thread actions filter comments correctly.
39-
out.push({
39+
threads.push({
4040
side: first.side,
4141
lineNumber: toDisplayLine(first.side, first.lineNumber),
4242
metadata: {
@@ -50,8 +50,9 @@ export function annotations(): AnnotationInput[] {
5050
},
5151
});
5252
}
53+
const changes: AnnotationInput[] = [];
5354
for (const ch of currentChanges().filter((ch) => ch.status === "pending" && !seen.has(ch.id))) {
54-
out.push({
55+
changes.push({
5556
side: ch.side,
5657
lineNumber: ch.displayEndLine ?? toDisplayLine(ch.side, ch.endLine ?? ch.lineNumber),
5758
metadata: {
@@ -64,7 +65,10 @@ export function annotations(): AnnotationInput[] {
6465
},
6566
});
6667
}
67-
return out;
68+
// When a thread and a change land on the same display line, the decision bar
69+
// must sit immediately under the hunk with the thread below it — annotations
70+
// render in array order, so changes go first.
71+
return [...changes, ...threads];
6872
}
6973

7074
// The waiting indicator under an unanswered question has three states, derived per

0 commit comments

Comments
 (0)