Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/app/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export const dict = {
"command.message.previous.description": "Go to the previous user message",
"command.message.next": "Next message",
"command.message.next.description": "Go to the next user message",
"command.message.top": "Jump to top",
"command.message.top.description": "Jump to the top of the chat",
"command.message.bottom": "Jump to bottom",
"command.message.bottom.description": "Jump to the bottom of the chat",
"command.model.choose": "Choose model",
"command.model.choose.description": "Select a different model",
"command.mcp.toggle": "Toggle MCPs",
Expand Down
8 changes: 8 additions & 0 deletions packages/app/src/pages/session.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -900,9 +900,17 @@ export default function Page() {
}

const focusInput = () => inputRef?.focus()
const jumpToTop = () => {
const el = scroller
if (!el) return
autoScroll.pause()
el.scrollTo({ top: 0, behavior: "auto" })
}

useSessionCommands({
navigateMessageByOffset,
jumpToTop,
jumpToBottom: () => resumeScroll(),
setActiveMessage,
focusInput,
review: reviewTab,
Expand Down
20 changes: 20 additions & 0 deletions packages/app/src/pages/session/use-session-commands.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import { useSessionLayout } from "@/pages/session/session-layout"

export type SessionCommandContext = {
navigateMessageByOffset: (offset: number) => void
jumpToTop: () => void
jumpToBottom: () => void
setActiveMessage: (message: UserMessage | undefined) => void
focusInput: () => void
review?: () => boolean
Expand Down Expand Up @@ -114,6 +116,8 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
}

const navigateMessageByOffset = actions.navigateMessageByOffset
const jumpToTop = actions.jumpToTop
const jumpToBottom = actions.jumpToBottom
const setActiveMessage = actions.setActiveMessage
const focusInput = actions.focusInput

Expand Down Expand Up @@ -345,6 +349,22 @@ export const useSessionCommands = (actions: SessionCommandContext) => {
disabled: !params.id,
onSelect: () => navigateMessageByOffset(1),
}),
sessionCommand({
id: "message.top",
title: language.t("command.message.top"),
description: language.t("command.message.top.description"),
keybind: "mod+shift+arrowup",
disabled: !params.id,
onSelect: jumpToTop,
}),
sessionCommand({
id: "message.bottom",
title: language.t("command.message.bottom"),
description: language.t("command.message.bottom.description"),
keybind: "mod+shift+arrowdown",
disabled: !params.id,
onSelect: jumpToBottom,
}),
modelCommand({
id: "model.choose",
title: language.t("command.model.choose"),
Expand Down
2 changes: 2 additions & 0 deletions packages/desktop/src/i18n/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ export const dict = {
"desktop.menu.view.forward": "Forward",
"desktop.menu.view.previousSession": "Previous Session",
"desktop.menu.view.nextSession": "Next Session",
"desktop.menu.view.jumpToTop": "Jump to Top",
"desktop.menu.view.jumpToBottom": "Jump to Bottom",
"desktop.menu.help.documentation": "OpenCode Documentation",
"desktop.menu.help.supportForum": "Support Forum",
"desktop.menu.help.shareFeedback": "Share Feedback",
Expand Down
10 changes: 10 additions & 0 deletions packages/desktop/src/menu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ export async function createMenu(trigger: (id: string) => void) {
text: t("desktop.menu.view.nextSession"),
accelerator: "Option+ArrowDown",
}),
await MenuItem.new({
action: () => trigger("message.top"),
text: t("desktop.menu.view.jumpToTop"),
accelerator: "Shift+Cmd+ArrowUp",
}),
await MenuItem.new({
action: () => trigger("message.bottom"),
text: t("desktop.menu.view.jumpToBottom"),
accelerator: "Shift+Cmd+ArrowDown",
}),
await PredefinedMenuItem.new({
item: "Separator",
}),
Expand Down
11 changes: 11 additions & 0 deletions packages/web/src/content/docs/keybinds.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@ The OpenCode desktop app prompt input supports common Readline/Emacs-style short

---

## Desktop chat navigation shortcuts

These shortcuts are available in the desktop app command system.

| Shortcut | Action |
| --------------------- | -------------------------- |
| `mod+shift+arrowup` | Jump to top of the chat |
| `mod+shift+arrowdown` | Jump to bottom of the chat |

---

## Shift+Enter

Some terminals don't send modifier keys with Enter by default. You may need to configure your terminal to send `Shift+Enter` as an escape sequence.
Expand Down
Loading