Skip to content

[Bug] 新增命令窗口无法用快捷键粘贴(默认快捷键下即复现) #509

Description

@emo172

[Bug] 新增命令窗口无法用快捷键粘贴(默认快捷键下即复现)

Summary (EN) — In the command-list "add command" dialog, keyboard paste (Ctrl+V) does nothing:
the keystroke is swallowed silently — no paste, no error, no feedback. Confirmed on a real machine
(Windows, 2.1.1) both with customized keybinds and after restoring the default shortcut (the
custom keybind= rows removed), so this is not merely a customization artifact. A source-level
mechanism that fully explains the customized case is included for reference; the default-state
failure is not yet root-caused.

通过命令行提交,无法填写网页表单。以下按 bug_report 模板字段组织。

Operating system / 操作系统

Windows

OS version and display / 系统版本与显示

Windows 11(build 26300),100% 缩放

Pebrel version / 版本号

2.1.1 (d574856)

How did you install Pebrel? / 安装方式

GitHub Release (.exe)

Shell in the affected pane / 出问题的面板用的 Shell

PowerShell 7 (pwsh)

Program running in the pane / 面板里正在跑的程序

Nothing, plain shell prompt / 什么都没跑

Connection type / 连接方式

Local terminal / 本地终端

Affected area / 影响范围

  • Keyboard / IME / mouse / shortcuts / clipboard — 键盘、输入法、鼠标、快捷键、剪贴板
  • Settings / theme / layout / blur — 设置页、主题、布局、模糊背景

Did it work in a previous version? / 旧版本是否正常?

Not sure / 不确定

Can you reproduce it? / 复现概率

Always (100%) / 必现

Steps to reproduce / 复现步骤

  1. 打开命令列表 → 「新增命令」,光标放进「名称」或「命令」输入框;
  2. 在其他应用复制任意文本到剪贴板;
  3. 按 Ctrl+V —— 无任何反应(Ctrl+Shift+V 同样无效);
  4. 已实测与快捷键自定义无关:先在 设置 → 按键映射 对「粘贴」行改绑/清空,再点「恢复此动作的
    默认快捷键」(设置文件中相应的 keybind= 行随之清除),两种状态下 Ctrl+V 均无法粘贴;
  5. 终端内粘贴不受影响;改绑状态下同一现象波及其他文本输入框(设置页搜索框等)。

Expected behavior / 期望结果

输入框内 Ctrl+V 应执行输入框自身的粘贴。gpui-component 的 Input 自带 ctrl-v → Paste 绑定;仓库测试
workspace/tests.rs:294-317 也专门断言「终端粘贴与组件
输入框粘贴按上下文各走各的」。

Actual behavior / 实际结果

按键被吞:无粘贴、无提示、无报错,全程零反馈。

Logs / screenshots / 日志或截图

按键被吞无画面可截。源码定位供参考(基准 main@b99383c;keyboard_bindings.rs 与 display/keymap.rs
在 v2.1.1 → main 之间无差异,已 git diff v2.1.1..origin/main 核对):

已证实的机制(改绑/清空态,可完整解释该态下失效):改绑或清空动作会为旧默认键写入
keybind=<combo>:ReceiveChar(display/keymap.rs:204-238);运行时 ReceiveChar 被注册为
无上下文的 gpui::NoAction,且同时注册到 None + 终端上下文两个作用域
(keyboard_bindings.rs:255-256, 285-294)。GPUI 键映射中「无上下文 = 最深上下文深度、
同深度后注册者胜」(依赖 gpui keymap.rs:154-159, 246-252),而用户绑定在 gpui_component::init
之后注册(keyboard_bindings.rs:61-62)——其 NoAction 因此在
「Input」上下文压过组件的 ctrl-v → Paste,输入框粘贴被吞。

未定位的部分:还原默认快捷键(设置文件已无相应行)后 Ctrl+V 仍无法粘贴——上述机制
解释不了这一态。两个候选方向(未验证,供排查):

  1. 「恢复默认」的热应用路径对 NoAction 撤销不完全:stale_removal_bindings
    (keyboard_bindings.rs:261-267)用 Unbind(action_name) 收回旧绑定,而 ReceiveChar 行
    注册出的 action 是 gpui::NoAction,Unbind 能否命中它需要验证;若不能,则需重启 Pebrel
    才能真正解除吞键(报告人的还原测试在运行中的实例上完成,未重启);
  2. 对话框输入框的焦点/上下文路由本身存在独立缺陷。

建议维护者从全新默认配置冷启动复测,以区分以上两态。

Non-default settings / 改过的设置

事发机「按键映射」页有历史自定义记录(改绑后又改回,pebrel_settings.txt 现含
keybind=ctrl+v:ReceiveChar / keybind=ctrl+shift+v:ReceiveChar / keybind=ctrl+shift+v:Paste
三行);但「恢复默认快捷键后仍无法粘贴」是清除这些行之后的
实测结果。

Before submitting / 提交前确认

No activity

Activity on this issue will appear here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    os: windows仅 Windows 或与 ConPTY/Win32 相关

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions