Skip to content

Home/end keys don't jump to the start/end of input as expected #54519

Closed as not planned

Description

@Timmmm

Description

Type some stuff, press home. The cursor should jump to the start of the input but it doesn't. I found this old issue about it but it's been closed as completed... #2649

Plugins

None

OpenCode version

1.18.34

Steps to reproduce

  1. Type some stuff.
  2. Press home

Screenshot and/or share link

No response

Operating System

Windows / WSL

Terminal

VSCode integrated

Activity

  1. opencode-agent commented on Oct 11, 2026

    @opencode-agent
    Contributor

    Thanks for the report, @Timmmm!

    Version 1.18.34 is OpenCode v1 (the opencode-ai package). v1 only gets fixes for critical bugs such as data loss, security problems or crashes, so this probably won't be fixed there. In the meantime, ctrl+a and ctrl+e move the cursor to the start and end of the line by default.

    We'd encourage you to try OpenCode v2 (@opencode/cli), where active development happens. Just so you know: from what I can see, v2 still binds home to jumping to the first message by default, and the input cursor movements are separate keybinds.

    Related issues:

    If you think this is critical, or if you can reproduce it on v2, please reply here with the v2 version (opencode --version) and we'll take another look.

  2. Timmmm commented on Oct 11, 2026

    @Timmmm
    Author

    I found several more reports of this that have all been automatically closed. You'd think this wouldn't be too hard to fix. I wonder if Pi has this issue... #27661 #29053 #31332.

    OpenCode v2 doesn't seem to have been released yet? But yeah it doesn't look like it is fixed.

  3. opencode-agent commented on Oct 11, 2026

    @opencode-agent
    Contributor

    Thanks for following up, @Timmmm. I reproduced this on v2.0.26 (@opencode/cli, now released), and it still happens on the latest dev (d21b079).

    Steps:

    1. Start a session and get a reply long enough to scroll.
    2. In the prompt type hello world and press Home: the message list jumps to the first message and the cursor stays where it was.
    3. Type X, press End, type Y: the prompt reads hello worldXY instead of Xhello worldY.

    On the start screen, before any session exists, Home and End do move the cursor. In a session, though, the default Home/End keybindings jump through the message list while you're typing. The recording and screenshot below show it, and the script below reproduces it.

    Until this is addressed, ctrl+a / ctrl+e move to the start or end of the line. Related reports: #27661, #29053, #31332, #2649.

    recording.mp4

    Screenshot

    Reproduction script (drive.ts)
    // Repro for #54519: Home/End do not move the prompt cursor to start/end of input.
    // After typing "hello world", press Home, then type "X". Expected "Xhello world".
    // Then press End and type "Y". Expected "Xhello worldY".
    import { Effect } from "effect"
    import { Llm, OpenCodeDriver } from "opencode-drive"
    
    const check = (ui: { capture: () => Effect.Effect<unknown, unknown, never> }, label: string) =>
      Effect.gen(function* () {
        const frame: any = yield* ui.capture()
        const text: string = JSON.stringify(frame)
        const lines = (frame.lines ?? frame.text?.split?.("\n") ?? []) as string[]
        const hit = (Array.isArray(lines) ? lines : []).filter((l: any) => String(l).match(/hello|world|X|Y/))
        yield* Effect.log(`${label}: ${hit.length ? hit.map(String).join(" | ") : text.match(/[^"]{0,20}hello world[^"]{0,20}/g)}`)
      })
    
    export default OpenCodeDriver.use(
      {
        ...(process.env.OC_DEV ? { opencode: { dev: process.env.OC_DEV } } : {}),
        tui: { recording: true, keypressOverlay: true },
      },
      ({ ui, llm }) =>
        Effect.gen(function* () {
          // 1) Home screen
          yield* ui.type("hello world")
          yield* Effect.sleep(300)
          yield* ui.press("home")
          yield* ui.type("X")
          yield* ui.press("end")
          yield* ui.type("Y")
          yield* Effect.sleep(500)
          yield* ui.screenshot("home-screen")
          yield* check(ui, "home screen")
    
          // clear prompt and go into a session
          yield* ui.press("u", { ctrl: true })
          yield* ui.press("u", { ctrl: true })
          yield* llm.queue(Llm.text("First reply.\n\n" + Array.from({ length: 40 }, (_, i) => `line ${i + 1}`).join("\n")))
          yield* ui.submit("first message")
          yield* ui.waitFor("line 40")
          yield* Effect.sleep(500)
    
          // 2) Inside a session
          yield* ui.type("hello world")
          yield* Effect.sleep(300)
          yield* ui.press("home")
          yield* Effect.sleep(300)
          yield* ui.screenshot("session-after-home")
          yield* ui.type("X")
          yield* ui.press("end")
          yield* Effect.sleep(300)
          yield* ui.type("Y")
          yield* Effect.sleep(500)
          yield* ui.screenshot("session-after-end")
          yield* check(ui, "session")
        }),
    )

    Run it with opencode-drive: opencode-drive run ./drive.ts. It drives opencode from your PATH; set OC_DEV to the path of an OpenCode checkout to run that from source instead.

  4. thdxr commented on Oct 11, 2026

    @thdxr
    Member

    Thanks for the report! OpenCode 2.0 is now out and development is focused on V2, so we're closing issues filed against OpenCode 1. Please upgrade (opencode upgrade --major, details: https://anoma.ly/notes/opencode-2-0), and if this is still relevant on 2.0, reopen this issue or open a new one with your 2.0 version.

    — from 𝕺𝖕𝖊𝖓𝕮𝖔𝖉𝖊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions