Skip to content
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
<h1 align="center">
This repo solves the Home and End keys not working
</h1>
<br>

<p align="center">
<a href="https://opencode.ai">
<picture>
Expand All @@ -13,7 +18,7 @@
<a href="https://www.npmjs.com/package/opencode-ai"><img alt="npm" src="https://img.shields.io/npm/v/opencode-ai?style=flat-square" /></a>
<a href="https://github.com/anomalyco/opencode/actions/workflows/publish.yml"><img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/anomalyco/opencode/publish.yml?style=flat-square&branch=dev" /></a>
</p>

<p align="center">
<a href="README.md">English</a> |
<a href="README.zh.md">简体中文</a> |
Expand Down
8 changes: 6 additions & 2 deletions packages/tui/src/config/keybind.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,10 @@ export const Definitions = {
messages_line_down: keybind("ctrl+alt+e", "Scroll messages down by one line"),
messages_half_page_up: keybind("ctrl+alt+u", "Scroll messages up by half page"),
messages_half_page_down: keybind("ctrl+alt+d", "Scroll messages down by half page"),
messages_first: keybind("ctrl+g,home", "Navigate to first message"),
messages_last: keybind("ctrl+alt+g,end", "Navigate to last message"),
messages_first: keybind("ctrl+g", "Navigate to first message"),
messages_last: keybind("ctrl+alt+g", "Navigate to last message"),
messages_first_home: keybind("home", "Navigate to first message"),
messages_last_home: keybind("end", "Navigate to last message"),
messages_next: keybind("none", "Navigate to next message"),
messages_previous: keybind("none", "Navigate to previous message"),
messages_last_user: keybind("none", "Navigate to last user message"),
Expand Down Expand Up @@ -345,6 +347,8 @@ export const CommandMap = {
messages_half_page_down: "session.half.page.down",
messages_first: "session.first",
messages_last: "session.last",
messages_first_home: "session.first_home",
messages_last_home: "session.last_home",
messages_next: "session.message.next",
messages_previous: "session.message.previous",
messages_last_user: "session.messages_last_user",
Expand Down
30 changes: 25 additions & 5 deletions packages/tui/src/routes/session/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { SplitBorder } from "../../ui/border"
import { useTuiPaths, useTuiTerminalEnvironment } from "../../context/runtime"
import { Spinner } from "../../component/spinner"
import { createSyntaxStyleMemo, generateSubtleSyntax, selectedForeground, useTheme } from "../../context/theme"
import { BoxRenderable, ScrollBoxRenderable, addDefaultParsers, TextAttributes, RGBA } from "@opentui/core"
import { BoxRenderable, type ScrollBoxRenderable, addDefaultParsers, TextAttributes, RGBA } from "@opentui/core"
import { Prompt, type PromptRef } from "../../component/prompt"
import type {
AssistantMessage,
Expand Down Expand Up @@ -152,7 +152,7 @@ const sessionGlobalBindingCommands = [
"session.half.page.down",
] as const

const sessionGlobalUnfocusedBindingCommands = ["session.first", "session.last"] as const
const sessionGlobalUnfocusedBindingCommands = ["session.first_home", "session.last_home"] as const

const context = createContext<{
width: number
Expand Down Expand Up @@ -316,7 +316,7 @@ export function Session() {
})
})

let lastSwitch: string | undefined = undefined
let lastSwitch: string | undefined
event.on("message.part.updated", (evt) => {
const part = evt.properties.part
if (part.type !== "tool") return
Expand Down Expand Up @@ -822,6 +822,26 @@ export function Session() {
dialog.clear()
},
},
{
title: "First message",
value: "session.first_home",
category: "Session",
hidden: true,
run: () => {
scroll.scrollTo(0)
dialog.clear()
},
},
{
title: "Last message",
value: "session.last_home",
category: "Session",
hidden: true,
run: () => {
scroll.scrollTo(scroll.scrollHeight)
dialog.clear()
},
},
{
title: "Jump to last user message",
value: "session.messages_last_user",
Expand Down Expand Up @@ -1188,7 +1208,7 @@ export function Session() {
{(message, index) => (
<Switch>
<Match when={message.id === revert()?.messageID}>
{(function () {
{(() => {
const redoShortcut = useCommandShortcut("session.redo")
const [hover, setHover] = createSignal(false)
const dialog = useDialog()
Expand Down Expand Up @@ -2260,7 +2280,7 @@ function Task(props: ToolProps) {
const content = createMemo(() => {
const description = stringValue(props.input.description)
if (!description) return ""
let content = [
const content = [
formatSubagentTitle(
Locale.titlecase(stringValue(props.input.subagent_type) ?? "General"),
description,
Expand Down
Loading