ssh越しのClaude Codeで改行できない問題を雑に解決する方法

blog
[BUG] Shift+Enter does not insert newline when running Claude Code via SSH (v2.1) · Issue #16859 · anthropics/claude-code
Preflight Checklist I have searched existing issues and this hasn't been reported yet This is a single bug report (pleas...

原因

Claude Codeの改行シーケンスが、\x1b\r (esc + cr)で認識しているが、モダンなターミナルだと改行を[27;2;13~ として送信してしまうため、うまく動かない。

雑解決策

Claude Code以外で不具合を起こすかもしれないが、ターミナルの設定で改行を\nとして扱えば良い。

WezTerm (~/.wezterm.lua)

local wezterm = require 'wezterm'
local config = wezterm.config_builder()

config.keys = {
  {
    key = 'Enter',
    mods = 'SHIFT',
    action = wezterm.action.SendString '\x1b\r',
  },
}

return config

Ghostty (~/.config/ghostty/config)

keybind = shift+enter=text:\x1b\r

Kitty (~/.config/kitty/kitty.conf)

map shift+enter send_text all \x1b\r

コメント

タイトルとURLをコピーしました