Skip to content

Home, End, Ctrl+Arrow keys not working in cn CLI despite correct terminal output #10535

@Hubbitus

Description

@Hubbitus

Before submitting your bug report

Relevant environment info

- OS: Fedora Linux 43
- Continue version: 1.5.43
- IDE version: cli
- Model: step-3.5-flash
- config: It hope irrelevant

  OR link to agent in Continue hub:

Description

Hi team,
The cn CLI currently does not respond to common navigation keys such as Home, End, Ctrl+←, and Ctrl+→, even though the terminal sends standard escape sequences for them.

Diagnosis

Running cat -v shows that these keys produce standard sequences:

  • Home^[[1~
  • End^[[4~
  • Ctrl+→^[[1;5C
  • Ctrl+←^[[1;5D

Other Node.js-based CLIs (e.g., gemini, qwen) do support these keys in the same environment, indicating the issue is specific to cn's input handling.

The problem stems from the fact that cn uses Ink’s useInput hook, which relies on the parse-key
library.
→ parse-key only supports a limited set of keys (arrows, Enter, Escape, Ctrl+C, etc.) and does not recognize:
\x1b[1~ (Home)
\x1b[4~ (End)
\x1b[1;5C / \x1b[1;5D (Ctrl+arrow)

Expected behavior

These standard navigation keys should work for editing multi-line prompts — especially important for long queries.

Suggested fix

Add a lightweight custom stdin parser (in raw mode) that maps common escape sequences to cursor/navigation actions, similar to how many other TUI CLIs do it. This can coexist with Ink’s renderer — only the input layer needs enhancement.
Example approach:

process.stdin.setRawMode(true);
process.stdin.on('data', (buf) => {
  const seq = buf.toString();
  if (seq === '\x1b[1~') {
    // move cursor to start (like Ctrl+A)
  } else if (seq === '\x1b[4~') {
    // move cursor to end (like Ctrl+E)
  } else if (seq === '\x1b[1;5C') {
    // move by word forward (Alt+F)
  } else if (seq === '\x1b[1;5D') {
    // move by word backward (Alt+B)
  } else {
    // pass through to Ink/useInput
  }
});

🖥️ Environment

  • OS: Fedora 43 (X11)
  • Terminal: Yakuake, Konsole
  • cn version: 1.5.43 (npm install -g continue-dev)
  • Node.js: v25.6.0

To reproduce

  1. Just start cn
  2. Enter e.g. One two three
  3. Hit key Home

Nothing happened. Expected to edit cursor moved to the beginning of the string.

Metadata

Metadata

Labels

area:dev-exRelates to devex, e.g. running locallykind:bugIndicates an unexpected problem or unintended behavioros:linuxHappening specifically on Linux

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions