From 6d8e9943837a73944911728a698138e23601d556 Mon Sep 17 00:00:00 2001 From: adamelmore <2363879+adamdottv@users.noreply.github.com> Date: Sat, 24 Jan 2026 09:09:23 -0600 Subject: fix(app): line selection fixes --- packages/app/src/components/prompt-input.tsx | 37 +++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 4 deletions(-) (limited to 'packages/app/src/components') diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx index 5a367aa61..18c1d98a7 100644 --- a/packages/app/src/components/prompt-input.tsx +++ b/packages/app/src/components/prompt-input.tsx @@ -170,6 +170,36 @@ export const PromptInput: Component = (props) => { const tabs = createMemo(() => layout.tabs(sessionKey)) const view = createMemo(() => layout.view(sessionKey)) + const commentInReview = (path: string) => { + const sessionID = params.id + if (!sessionID) return false + + const diffs = sync.data.session_diff[sessionID] + if (!diffs) return false + return diffs.some((diff) => diff.file === path) + } + + const openComment = (item: { path: string; commentID?: string; commentOrigin?: "review" | "file" }) => { + if (!item.commentID) return + + comments.setFocus({ file: item.path, id: item.commentID }) + view().reviewPanel.open() + + if (item.commentOrigin === "review") { + tabs().open("review") + return + } + + if (item.commentOrigin !== "file" && commentInReview(item.path)) { + tabs().open("review") + return + } + + const tab = files.tab(item.path) + tabs().open(tab) + files.load(item.path) + } + const recent = createMemo(() => { const all = tabs().all() const active = tabs().active() @@ -1481,6 +1511,7 @@ export const PromptInput: Component = (props) => { selection: item.selection, comment: item.comment, commentID: item.commentID, + commentOrigin: item.commentOrigin, preview: item.preview, }) } @@ -1547,6 +1578,7 @@ export const PromptInput: Component = (props) => { selection: item.selection, comment: item.comment, commentID: item.commentID, + commentOrigin: item.commentOrigin, preview: item.preview, }) } @@ -1700,10 +1732,7 @@ export const PromptInput: Component = (props) => { "cursor-pointer hover:bg-surface-interactive-weak": !!item.commentID, }} onClick={() => { - if (!item.commentID) return - comments.setFocus({ file: item.path, id: item.commentID }) - view().reviewPanel.open() - tabs().open("review") + openComment(item) }} >
-- cgit v1.2.3