ViMode crashed during c-F ViReplaceToCharBackward operation, attempting to specify ^ beginning of line.
还没有人认领这个 Issue。
评估
调研方向
Start with the stack-trace entry points Microsoft.PowerShell.PSConsoleReadLine.StartEditGroup, GroupUndoHelper.StartGroup, and ViInsertWithDelete, then reproduce the listed Vi-mode key sequence with a short input. Done means the c F ^ c F sequence and final ^ no longer throw an InvalidOperationException; add or update a regression test if the relevant test location is found.
由索引模型根据 Issue 内容生成。
描述
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
PS C:\Users\Home> `
(GEt-Item $_.Path) | % {
Oops, something went wrong.
Please report this bug with ALL the details below, including both the 'Environment' and 'Exception' sections.
Please report on GitHub: https://github.com/PowerShell/PSReadLine/issues/new?template=Bug_Report.yaml
Thank you! $_.BaseName
$_.DirectoryName
### Environment;
PSReadLine: 2.3.6+d2e770f93b7a53d8660a6402eb29d1ae1c35e767
PowerShell: 7.5.0-rc.1Object -Property Count -Descending `
OS: Microsoft Windows 10.0.19045
BufferWidth: 195 -f blue $_.Group[0].Hash;
BufferHeight: 48oreach{
}
Last 200 Keys:
}
c t Backspace Backspace Backspace l e c t - f o r k * " Spacebar ` Enter Backspace LeftArrow } Shift+Spacebar Enter O v e o p g a v e r Enter UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow DownArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow Enter UpArrow UpArrow UpArrow UpArrow UpArrow Enter UpArrow LeftArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow DownArrow DownArrow Ctrl+[ d d UpArrow p UpArrow UpArrow p DownArrow DownArrow d d Enter UpArrow LeftArrow LeftArrow LeftArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow Ctrl+[ d 8 d k k k k k o p Backspace Ctrl+[ p x Ctrl+[ Backspace Backspace x UpArrow p x UpArrow Ctrl+c UpArrow DownArrow DownArrow UpArrow RightArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow UpArrow UpArrow DownArrow d 8 d k k k k k p < Backspace x Ctrl+[ Backspace x RightArrow LeftArrow i Ctrl+[ < Backspace x DownArrow DownArrow DownArrow UpArrow UpArrow UpArrow Shift+DownArrow Shift+DownArrow Shift+DownArrow Shift+RightArrow Shift+RightArrow w c F ^ l s
### Exception
System.InvalidOperationException: Operation is not valid due to the current state of the object.
at Microsoft.PowerShell.PSConsoleReadLine.StartEditGroup()
at Microsoft.PowerShell.PSConsoleReadLine.GroupUndoHelper.StartGroup(Action`2 instigator, Object instigatorArg)
at Microsoft.PowerShell.PSConsoleReadLine.ViInsertWithDelete(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
PS C:\Users\Home> `
(GEt-Item $_.Path) | % {
$x = $(
$_.Mode
$_.LastWriteTime
$_.BaseName
$_.DirectoryName
);
$x -join ", "
$moreThanOne | Sort-Object -Property Count -Descending `
| % {
Write-host -f blue $_.Group[0].Hash;
$_.Group.Foreach{
}
}
}
Screenshot
just after the exception:
what was in my buffer the moment before:
Environment data
PS Version: 7.5.0-rc.1
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.3.6
PSReadLine EditMode: Vi
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 195
BufferHeight: 48
Steps to reproduce
repro:
- open a powershell terminal. (either 5.1 or or 7)
- invoke
Set-PSReadlineOption -editMode vi - enter some text at the prompt
- press
Escto switch to vi command mode - press the following keys:
c F ^ c F - now press
^a final time, and the exception will occur.
screenshot here: https://github.com/PowerShell/PSReadLine/issues/4423#issuecomment-2629048026
unfortunately I am unable to reproduce the issue in a fresh pwsh tab.
PLEASE STAND BY... I have been able to reproduce this in a fresh environment, by attempting the operation twice. I keep getting interrupted, but I intend to provide a full repro later today.
Expected behavior
Not sure what I would expect, because I was just experimenting with Vi mode, trying to remove spaces from the beginning of a line. As far as I know, the key keystrokes that I was using are not a valid way of performing the operation that I was attempting; I was just experimenting to see what would happen.
Larger context: I was trying to unindent a block of code which I had cut from below with 'd 8 d', and then pasted at the top with a 'p' command.
Actual behavior
** BOOM **
- 主要语言
- C#
- 星标
- 4.4k
- 派生
- 341
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
PowerShell/PSReadLine 的其他 Issue
-
Needs-Triage :mag:
难度 2/5 1-3 小时 新手友好度 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
难度 2/5 1-3 小时 新手友好度 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
难度 2/5 1-3 小时 新手友好度 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
难度 2/5 1-3 小时 新手友好度 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
难度 1/5 1 小时以内 新手友好度 68/100
PowerShell/PSReadLine#3470 · 3 个 reaction ·
查看 PowerShell/PSReadLine 的全部 Issue
相似的 Issue
-
bug
难度 1/5 1 小时以内 新手友好度 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
难度 2/5 1-3 小时 新手友好度 72/100
azurenoops/spin_agent#975 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
难度 2/5 1-3 小时 新手友好度 92/100
dotnet/AspNetCore.Docs#37699 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
SubtitleEdit/subtitleedit#15108 · 1 条评论 ·