kimi-code icon indicating copy to clipboard operation
kimi-code copied to clipboard

Shift+Enter无法正确换行

Open Aalivexy opened this issue 6 months ago • 15 comments

What version of Kimi Code is running?

0.6.0

Which open platform/subscription were you using?

OAuth

Which model were you using?

kimi-k2.6

What platform is your computer?

Microsoft Windows NT 10.0.26200.0 x64

What issue are you seeing?

输入框输入Shift+Enter无法正确换行

What steps can reproduce the bug?

输入Shift+Enter

What is the expected behavior?

正确换行

Additional information

No response

Aalivexy avatar May 31 '26 10:05 Aalivexy

仅 Windows Terminal 复现,Alacritty 内表现正常,Windows Terminal 版本 1.24.11321.0

Aalivexy avatar May 31 '26 10:05 Aalivexy

我 ubuntu 试了opencode/claude code,都不支持 Shift+Enter 换行操作

zha-ji-tui avatar Jun 01 '26 03:06 zha-ji-tui

我 ubuntu 试了opencode/claude code,都不支持 Shift+Enter 换行操作

那你试试 Ubuntu 下的 kimi-code?这个应该正常

Aalivexy avatar Jun 01 '26 04:06 Aalivexy

我 ubuntu 试了opencode/claude code,都不支持 Shift+Enter 换行操作

那你试试 Ubuntu 下的 kimi-code?这个应该正常

测了下,要按住 Alt+Enter 换行

zha-ji-tui avatar Jun 01 '26 05:06 zha-ji-tui

我 ubuntu 试了opencode/claude code,都不支持 Shift+Enter 换行操作

那你试试 Ubuntu 下的 kimi-code?这个应该正常

测了下,要按住 Alt+Enter 换行

https://moonshotai.github.io/kimi-code/zh/reference/keyboard.html

以上是文档,我没太明白你想表达的内容emmmm

Aalivexy avatar Jun 01 '26 05:06 Aalivexy

我 ubuntu 试了opencode/claude code,都不支持 Shift+Enter 换行操作

那你试试 Ubuntu 下的 kimi-code?这个应该正常

测了下,要按住 Alt+Enter 换行

https://moonshotai.github.io/kimi-code/zh/reference/keyboard.html

以上是文档,我没太明白你想表达的内容emmmm

Image 如图所示,在ubuntu的kimi code中,通过alt + Enter实现插入换行符

zha-ji-tui avatar Jun 01 '26 06:06 zha-ji-tui

@zha-ji-tui 我的意思是,在 Windows Terminal 上官方文档中写的 Shift+Enter 插入换行符不起作用,有 bug,Linux 下我使用此快捷键没问题

Aalivexy avatar Jun 01 '26 07:06 Aalivexy

@zha-ji-tui 我的意思是,在 Windows Terminal 上官方文档中写的 Shift+Enter 插入换行符不起作用,有 bug,Linux 下我使用此快捷键没问题

你是什么发行版,我的ubuntu无法Shift+Enter 插入换行符

zha-ji-tui avatar Jun 01 '26 07:06 zha-ji-tui

@zha-ji-tui 我的意思是,在 Windows Terminal 上官方文档中写的 Shift+Enter 插入换行符不起作用,有 bug,Linux 下我使用此快捷键没问题

你是什么发行版,我的ubuntu无法Shift+Enter 插入换行符

ArchLinux ghostty fishshell

Windows Alacritty fishshell 均没问题

Aalivexy avatar Jun 01 '26 08:06 Aalivexy

此问题大概率和你使用的终端模拟器也有关系,如果可以的话,请附上你使用的终端模拟器 @zha-ji-tui

Aalivexy avatar Jun 01 '26 08:06 Aalivexy

此问题大概率和你使用的终端模拟器也有关系,如果可以的话,请附上你使用的终端模拟器 @zha-ji-tui

GNOME Terminal 3.52.0 using VTE 0.76.0 +BIDI +GNUTLS +ICU +SYSTEMD

zha-ji-tui avatar Jun 01 '26 08:06 zha-ji-tui

此问题大概率和你使用的终端模拟器也有关系,如果可以的话,请附上你使用的终端模拟器 @zha-ji-tui

GNOME Terminal 3.52.0 using VTE 0.76.0 +BIDI +GNUTLS +ICU +SYSTEMD

我可以复现这个的问题。

怪啊,第三方终端模拟器好像没有有问题的,操作系统第一方终端模拟器不行?

Aalivexy avatar Jun 01 '26 08:06 Aalivexy

并非所有终端都可以正确读取shift+enter,特别是在tmux下几乎不可能正确设置并使用shift+enter。但是在kimi code中ctrl+j应该在任何环境下都可以正确换行。

Eric-Song-Nop avatar Jun 01 '26 15:06 Eric-Song-Nop

Adding context from my legacy kimi-cli PR: MoonshotAI/kimi-cli#2302 added Shift+Enter as a newline shortcut alongside Ctrl-J and Alt-Enter.

The useful test matrix from that PR still applies here:

  • Shift+Enter inserts a newline and does not submit the prompt.
  • Ctrl-J still inserts a newline for compatibility.
  • Alt/Option+Enter behavior should remain unchanged if supported.
  • The footer/help text should match the actual supported shortcuts.

I see MoonshotAI/kimi-code#272 is already working on CSI-u Shift+Enter handling, so this comment is mainly to connect the old kimi-cli work and expected behavior to the kimi-code issue.

ktwu01 avatar Jun 08 '26 22:06 ktwu01

补充一个精确定位过的同类 case(0.34.0,macOS,Ghostty + herdr 终端复用器):

结论:kimi 的 TUI 不解析 legacy 编码 ESC CR(\x1b\r,即传统 Alt+Enter 编码),而很多终端/复用器正是用这个编码来交付 Shift+Enter 的。

字节级实测(在 pane 内用 raw mode 抓取):

来源 pane 实际收到的字节 kimi 表现
物理 Shift+Enter(Ghostty keybind text:\x1b\r,也是 iTerm2/部分复用器的常见默认) \x1b\r 无任何反应(不换行也不提交)
kitty keyboard protocol \x1b[13;2u 正常换行
xterm modifyOtherKeys \x1b[27;2;13~ 正常换行
Ctrl-J \n 正常换行

即 kimi 目前只认两种 CSI 序列和 \n,不认 \x1b\r。同环境下 Claude Code / Codex 正常,是因为它们同时把 ESC CR(Alt+Enter)也绑定为插入换行。

建议:把 \x1b\r 也绑定为"插入换行"。这是各终端对 Shift+Enter 最常见的兜底编码(很多终端在不支持/未协商扩展键盘协议时就发这个,用户侧也常通过 keybind 主动映射成它),支持后这类 issue 能覆盖掉一大片。

tungloong avatar Aug 11 '26 10:08 tungloong