Skip to content

Feature Request: Smart arrow key navigation for multiline input (cursor navigation vs history) #1320

@imbecile-gulu

Description

@imbecile-gulu

What feature would you like to see?

Feature Request

Problem Description

Currently, when typing multiline input in kimi-cli, the Up/Down arrow keys always navigate through command history, e
ven when the cursor is in the middle of a multiline text. This makes it inconvenient to edit multiline prompts becaus
e users cannot use arrow keys to move the cursor between lines.

Expected Behavior

Implement smart arrow key navigation similar to Claude Code's approach:

Cursor Position Up Arrow Down Arrow
Not at boundary (can move up/down in text) Move cursor up one line Move cursor down one line
At top boundary (first line) Show previous history entry Move cursor down one line
At bottom boundary (last line) Move cursor up one line Show next history entry

Use Case

When writing long prompts with multiple lines (e.g., using Alt+Enter or Ctrl+J to insert newlines), users often n
eed to navigate within the text to make edits. Currently, pressing Up arrow immediately switches to the previous hist
ory entry, losing the current input context.

Proposed Implementation

The logic could work as follows:

def handle_up_arrow(buffer):
    if cursor_not_at_first_line(buffer):
        move_cursor_up()
    else:
        show_previous_history()

def handle_down_arrow(buffer):
    if cursor_not_at_last_line(buffer):
        move_cursor_down()
    else:
        show_next_history()

Reference

Claude Code implements this feature in their Vim mode with the following behavior:

▌ "In vim normal mode, if the cursor is at the beginning or end of input and cannot move further, the arrow keys navigate command history instead"

### Additional information

This feature would significantly improve the user experience when writing complex multiline prompts, especially for users who frequently write code blocks or detailed instructions in the input.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions