Skip to content

Commit c6d8e76

Browse files
authored
fix(app): on cancel comment unhighlight lines (anomalyco#14103)
1 parent 0d0d057 commit c6d8e76

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

packages/app/src/pages/session/file-tabs.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,12 @@ export function FileTabContent(props: { tab: string }) {
371371
})
372372
}
373373

374+
const cancelCommenting = () => {
375+
const p = path()
376+
if (p) file.setSelectedLines(p, null)
377+
setNote("commenting", null)
378+
}
379+
374380
createEffect(
375381
on(
376382
() => state()?.loaded,
@@ -484,7 +490,7 @@ export function FileTabContent(props: { tab: string }) {
484490
value={note.draft}
485491
selection={formatCommentLabel(range())}
486492
onInput={(value) => setNote("draft", value)}
487-
onCancel={() => setCommenting(null)}
493+
onCancel={cancelCommenting}
488494
onSubmit={(value) => {
489495
const p = path()
490496
if (!p) return
@@ -498,7 +504,7 @@ export function FileTabContent(props: { tab: string }) {
498504

499505
setTimeout(() => {
500506
if (!document.activeElement || !current.contains(document.activeElement)) {
501-
setCommenting(null)
507+
cancelCommenting()
502508
}
503509
}, 0)
504510
}}

0 commit comments

Comments
 (0)