Skip to content

[BUG REPORT] Windows 上滚轮按系统行数重复上报,导致 TUI 滚动距离成倍放大 #68

Closed

Description

@WhiteGiverMa

Where

Windows

What happened

Windows 鼠标设置为「每次滚动 5 行」时,OpenCode 的滚动距离在 ELYTerminal 中被额外放大 5 倍:

OpenCode Scroll speed ELYTerminal 每个标准滚轮刻度的移动距离
3.00 15 行
5.00 25 行

同一鼠标、同一 OpenCode 配置在 Windows Terminal 中没有这个额外倍率。

Steps to reproduce

  1. Windows 设置 → 鼠标,将每次滚动行数设为 5,然后启动终端。
  2. 在 ELYTerminal 中运行 OpenCode,保持鼠标捕获开启、滚动加速关闭,打开足够长的会话。
  3. 将 Scroll speed 设为 3.00,鼠标放在会话正文,不按 Shift,慢慢转动一个标准滚轮刻度。
  4. 改为 5.00 再试,并与 Windows Terminal 对照。

What you expected

鼠标跟踪模式下,一个标准滚轮刻度对应一次 wheel 上报,由应用决定滚动距离;终端自身的历史仍按系统设置的行数滚动。

Commit or version

  • ELYTerminal 0.2.2,Windows x86_64,v0.2.2(a0550a6)。
  • OpenCode 2.2.5;Windows Terminal 1.24.12741.0。
  • Windows 11 build 26300;SPI_GETWHEELSCROLLLINES = 5。

Cause and verification

GPUI Windows 已将原始滚轮刻度乘以系统行数,生成 ScrollDelta::Lines:

OpenCode 的速度设置 按每条输入计算距离,因此产生 5 × 3 = 15、5 × 5 = 25。

已通过真实 ELY 窗口和原始 VT 输入子程序确认:系统设为每格 5 行时,向窗口发送一个 WM_MOUSEWHEEL(delta +120),子程序收到 5 条 SGR wheel-up 报告;将同一刻度拆成 10 个 delta +12 的消息,合计仍为 5 条。

这与已修复的 #24 不同:#24 是本地历史滚动额外乘 3,本问题是将历史行数误作应用鼠标报告次数。上述 ELY 路径在 main ba664ef6 与 v0.2.2 一致。

修复及回归验证见 #69。字节验证使用原生窗口消息,经 GPUI、ELY 和 ConPTY 到达子程序,不是物理鼠标录制;修复后的 OpenCode 视觉滚动尚未实测。

Activity

  1. WhiteGiverMa commented on Nov 3, 2026

    @WhiteGiverMa
    ContributorAuthor

    是在用OpenCode的时候发现的,挺喜欢这个终端的居然带Windows玩www 在用gpt写个pr,麻烦代码审查了,添麻烦了啾咪

  2. WhiteGiverMa commented on Nov 3, 2026

    @WhiteGiverMa
    ContributorAuthor

    补充字节验证:系统设为每格 5 行,向启用 1000 / 1006 的 ELY 窗口发送 WM_MOUSEWHEEL:

    输入 修复前 #69 修复后
    delta +120 5 条 SGR wheel-up 1 条
    10 个 delta +12 合计 5 条 SGR wheel-up 合计 1 条
    delta -120 未对照 1 条 SGR wheel-down

    结果来自真实 GPUI → ELY → OpenConsole / ConPTY → 子程序输入链路;不是物理鼠标录制,修复后的 OpenCode 视觉滚动尚未实测。

  3. Raiden-MeixElysia commented on Nov 5, 2026

    @Raiden-MeixElysia
    Contributor

    Fixed by #69, on main as cae1833; ships in the next release.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions