ListView does not render the first selection after reuse in Vi insert mode

未关闭
#5,178 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
65/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
冷清
技术栈
csharp
领域
cli

调研方向

Reproduce with pwsh -noprofile, Vi edit mode, and ListView prediction settings, then compare the first DownArrow after reopening ListView with the initial use. Trace the ListView navigation path and Vi insert-mode handling. Done means the first press visibly highlights the internally selected item on every reuse, with Enter and subsequent navigation remaining consistent.

由索引模型根据 Issue 内容生成。

描述

Needs-Triage :mag:
Prerequisites
  • Write a descriptive title.
  • Make sure you are able to repro it on the latest released version
  • Search the existing issues, especially the pinned issues.
Exception report
N/A
Screenshot

Long-time Vi mode user. For a couple of years, I've been dealing w/ an obscure behavior and finally taking time to report it.

Issue: In Vi insert mode with PredictionViewStyle set to ListView, the first DownArrow press after reusing the list selects a history item internally but fails to render its highlight until another navigation key is pressed.

More Detail:

When using these PSReadLine options:

Set-PSReadLineOption -PredictionViewStyle ListView
Set-PSReadLineOption -EditMode Vi

the first DownArrow press in the prediction selects a history entry internally without visually rendering the selection highlight.

Pressing Enter at that point executes/accepts the first history item, which indicates that the item was selected despite no visible highlight. Pressing DownArrow a second time causes the selection highlight to appear. After that, UpArrow and DownArrow behave and render normally.

Note: The issue does not occur the first time ListView is used in a new PowerShell session; it only begins after ListView has already been used once.

Entering Vi normal mode and then returning to insert mode resets the behavior, e.g. Esc + i. After that, the first DownArrow press renders correctly again, until the issue recurs.

Image
Environment data
PS Version: 7.6.3
PS HostName: ConsoleHost
PSReadLine Version: 2.4.5
PSReadLine EditMode: Vi
OS: 10.0.26100.1 (WinBuild.160101.0800)
BufferWidth: 180
BufferHeight: 50
Steps to reproduce
  1. Run pwsh -noprofile
  2. Run Set-PSReadLineOption -EditMode Vi
  3. Run Set-PSReadlineOption -PredictionViewStyle ListView
  4. In Vi insert mode, type text that produces history predictions
  5. Use the ListView and navigate it with DownArrow (on the first use in a new session, the highlight appears as expected)
  6. Complete or dismiss the ListView (e.g. ESC to dismiss and cc to clear the line/command)
  7. Trigger ListView again and press DownArrow once

On the second and later uses of ListView:

  • The first DownArrow press appears to do nothing visually.
  • No entry is highlighted.
  • Pressing Enter accepts or runs the first list item, indicating that the selection changed internally.
  • Pressing DownArrow a second time causes the visual highlight to appear.
  • Subsequent UpArrow and DownArrow presses render correctly.
Expected behavior
  • Each DownArrow press in ListView should visibly move the selection to the next prediction.
  • On the first press, the first matching history entry should be highlighted immediately.
  • The visible highlight and the internally selected item should always remain in sync.
  • This should behave consistently every time ListView is opened while in Vi insert mode.
Actual behavior
  • After ListView has been used once, reopening it in Vi insert mode produces no visible highlight on the first DownArrow press.
  • The first item appears unselected, but it is selected internally.
  • Pressing Enter accepts/runs that first item despite the missing highlight.
  • A second DownArrow press makes the highlight appear, after which navigation renders normally.
  • Pressing Esc and then i temporarily resets the behavior.
主要语言
C#
星标
4.4k
派生
341
PR 合并指标
30 天内没有已合并 PR

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

PowerShell/PSReadLine 的其他 Issue

查看 PowerShell/PSReadLine 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。