[BUG] Ctrl+E stops at halfway when line contains Japanese/multibyte characters

Resolved 💬 2 comments Opened Jun 28, 2025 by nakamura-1234 Closed Jul 3, 2025

## Description

When using Ctrl+E (move to end of line) in Claude Code's interactive mode, the cursor stops at approximately half the visual line length when the line contains Japanese or other multibyte characters. Note that Ctrl+A
(move to beginning of line) works correctly.

## Environment

  • OS: macOS Darwin 24.5.0
  • Claude Code version: 1.0.35 (Claude Code)
  • Terminal: [e.g., Terminal.app, iTerm2]
  • Shell: [e.g., zsh, bash]

## Steps to Reproduce

  1. Start Claude Code in interactive mode: claude
  2. Type a line containing both ASCII and Japanese characters:

Hello こんにちは World

  1. Press Ctrl+A to move to the beginning of the line (this works correctly)
  2. Press Ctrl+E to attempt to move to the end of the line
  3. Observe that the cursor stops approximately halfway through the line instead of reaching the end

## Expected Behavior

Ctrl+E should move the cursor to the actual end of the line, after "World".

## Actual Behavior

Ctrl+E stops the cursor at approximately 50% of the visual line position, typically in the middle of the Japanese text.

## Root Cause Analysis

This appears to be specific to the Ctrl+E implementation when handling multibyte characters:

  • Japanese characters in UTF-8 use 3 bytes per character
  • Japanese characters display as 2 columns width (full-width)
  • The Ctrl+E logic seems to calculate the end position based on byte count rather than visual column count
  • Ctrl+A works correctly, suggesting the issue is isolated to the end-of-line calculation

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗