rime / rime/squirrel

在 Kitty 终端中使用五笔方案时,退格清空 preedit 会额外删除终端已有字符

Open
#1,121 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
6.4k
Forks
554
PR merge metrics
No merged PRs in 30d

Description

内容:

环境

macOS
Squirrel 最新版
Kitty 0.46.2
输入方案:98五笔

复现步骤

在 Kitty 中输入若干字符(如 123)已上屏
用五笔输入编码(如 nih),进入 preedit 状态
连续按退格删除 preedit 编码
当 preedit 从有内容变为空的瞬间,终端里已上屏的字符也被多删一个

拼音方案不复现,系统自带拼音不复现,Terminal.app 不复现。
Kitty --debug-input 日志显示的关键行为:
退格删到最后一个 preedit 字符时(第一次退格):
state: 1 updated pre-edit text: ''
Ignoring key press as IME is active and it generated no text
此时 Kitty 正确地忽略了这次退格,没有发 0x7f 给终端。
但 Squirrel 在调用 setMarkedText: "" 清空 markedText 时,Kitty 将其解释为需要额外执行一次 deleteBackward:,导致终端多删一个字符。
根本原因推测:
Squirrel 在 preedit 清空时调用 setMarkedText: "",而不是 unmarkText。Kitty 对空 markedText 的处理与标准 NSTextInputClient 行为有差异,导致额外触发删除。拼音方案因 preedit 状态转换方式不同,不触发此问题。

kitty.log

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing Squirrel’s macOS text-input implementation around setMarkedText: and unmarkText, using the reported 98 Wubi sequence in Kitty to reproduce the transition. Compare the handling of an empty marked text with the existing preedit lifecycle. Done means clearing the final preedit character no longer deletes an already committed terminal character, while normal backspace behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
macos, swift
Domain
desktop
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.