Skip to content

[BUG REPORT] 修复 Windows 鼠标跟踪程序的滚轮上报被系统行数放大 - #69

Open
WhiteGiverMa wants to merge 1 commit into
ELY-Open-Source:mainfrom
WhiteGiverMa:fix/windows-wheel-reports
Open

WhiteGiverMa wants to merge 1 commit into
ELY-Open-Source:mainfrom
WhiteGiverMa:fix/windows-wheel-reports

Conversation

@WhiteGiverMa

@WhiteGiverMa WhiteGiverMa commented Nov 3, 2026 •

Copy link
Copy Markdown

Type

  • [FEATURE REQUEST]: a new feature or an improvement
  • [BUG REPORT]: a bug fix
  • [Other]: docs, refactoring, CI, dependencies or chores

What and why

Windows 鼠标跟踪模式下按滚轮刻度计数,避免系统滚动行数放大 TUI 的输入次数。

Closes #68

Bug details

  • Steps to reproduce: Windows 每格滚动 5 行,在 ELYTerminal 中运行开启鼠标捕获的 OpenCode 2.2.5,转动一个标准刻度。
  • Expected: 一次滚轮上报,由应用决定滚动距离。
  • Actual: 发送 5 条报告;OpenCode 的 Scroll speed 3.00 / 5.00 分别移动 15 / 25 行。
  • Cause and fix: GPUI 已将原始刻度乘以 SPI_GETWHEELSCROLLLINES。仅在 Windows 且鼠标跟踪开启时,在累加、截断和限幅前除回该值,并使用独立的小数残量,避免混合「行」与「刻度」。

本地历史、Shift、备用屏幕箭头、Pixels 换算及其他平台的原有路径保持不变。没有新增配置或依赖。

How it was tested

Windows 11 build 26300,x86_64 MSVC,Rust 1.95.0:

cargo fmt --check
cargo clippy --locked --all-targets -- -D warnings
cargo test --locked --quiet
cargo build --locked
git diff --check

以上通过,完整测试 418 passed。

新增 3 项 Windows 回归在旧实现下失败、修复后通过,覆盖:

  • 每格 1 / 3 / 5 / 100 行及 WHEEL_PAGESCROLL,包含反向和一次多格。
  • 一个刻度拆成 2 / 10 / 120 段,完整累积后上报。
  • 系统禁用滚动、NaN 和 Pixels 输入。

另启真实 ELY 窗口,子程序启用 1000 / 1006 并读取原始 VT 输入。定向发送 WM_MOUSEWHEEL,经过 GPUI、ELY 和随程序附带的 OpenConsole / ConPTY:

原生输入,系统每格 5 行 修复前 修复后
delta +120 5 条 wheel-up 1 条 wheel-up
10 个 delta +12 合计 5 条 wheel-up 合计 1 条 wheel-up
delta -120 未对照 1 条 wheel-down

验证边界:这是原生窗口消息驱动,不是物理鼠标录制。修复后的 OpenCode 视觉滚动、其他平台运行时及其他系统行数的 GUI 行为尚未实测;其他行数由函数回归测试覆盖。

Checklist

  • The title starts with [FEATURE REQUEST], [BUG REPORT] or [Other]
  • Tests and the build pass locally
  • Docs are updated if behaviour changed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant