summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAdam <[email protected]>2026-01-22 22:03:06 -0600
committerAdam <[email protected]>2026-01-22 22:12:12 -0600
commitd35fabf5dbf33028cbc7c295fbd4f413f3d4bc44 (patch)
treee1bd71c6ca264006afedb0bf6599ba262505d5f9
parent82f718b3cfd19cd79171d240851e29127c9d8077 (diff)
downloadopencode-d35fabf5dbf33028cbc7c295fbd4f413f3d4bc44.tar.gz
opencode-d35fabf5dbf33028cbc7c295fbd4f413f3d4bc44.zip
chore: cleanup
-rw-r--r--packages/app/src/components/prompt-input.tsx13
1 files changed, 13 insertions, 0 deletions
diff --git a/packages/app/src/components/prompt-input.tsx b/packages/app/src/components/prompt-input.tsx
index f0ac47632..24a96d1b4 100644
--- a/packages/app/src/components/prompt-input.tsx
+++ b/packages/app/src/components/prompt-input.tsx
@@ -161,6 +161,19 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
const sessionKey = createMemo(() => `${params.dir}${params.id ? "/" + params.id : ""}`)
const tabs = createMemo(() => layout.tabs(sessionKey()))
const view = createMemo(() => layout.view(sessionKey()))
+
+ const selectionPreview = (path: string, selection: FileSelection | undefined, preview: string | undefined) => {
+ if (preview) return preview
+ if (!selection) return undefined
+ const content = files.get(path)?.content?.content
+ if (!content) return undefined
+ const start = Math.max(1, Math.min(selection.startLine, selection.endLine))
+ const end = Math.max(selection.startLine, selection.endLine)
+ const lines = content.split("\n").slice(start - 1, end)
+ if (lines.length === 0) return undefined
+ return lines.slice(0, 2).join("\n")
+ }
+
const recent = createMemo(() => {
const all = tabs().all()
const active = tabs().active()