Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[vi-mode] GotoFirstNonBlankOfLine crashes PSRL when buffer is empty #2050

Closed
springcomp opened this issue Dec 17, 2020 · 2 comments · Fixed by #2051
Closed

[vi-mode] GotoFirstNonBlankOfLine crashes PSRL when buffer is empty #2050

springcomp opened this issue Dec 17, 2020 · 2 comments · Fixed by #2051

Comments

@springcomp
Copy link
Contributor

Environment

PS version: 7.2.0-daily.20201215
PSReadline version: 2.1.0
os: 10.0.18362.1130 (WinBuild.160101.0800)
PS file version: 7.2.0.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 120
BufferHeight: 30

Exception report

Last 24 Keys

 S e t - P S R e a d L i n e O p t i o n RightArrow Enter Escape _

Exception

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Text.StringBuilder.get_Chars(Int32 index)
   at Microsoft.PowerShell.PSConsoleReadLine.IsVisibleBlank(Int32 newCurrent)
   at Microsoft.PowerShell.PSConsoleReadLine.GetFirstNonBlankOfLogicalLinePos(Int32 current)
   at Microsoft.PowerShell.PSConsoleReadLine.GotoFirstNonBlankOfLine(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)

Steps to reproduce

Run PSRL:

Set-PSReadLineOption -EditMode Vi

Then type the following sequence: Esc, _

Expected behavior

Nothing should happen. Possibly, key may ding.

Actual behavior

PSRL crashes.

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Dec 17, 2020
springcomp added a commit to springcomp/PSReadLine that referenced this issue Dec 17, 2020
@ghost ghost added Resolution-Fixed and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels Feb 10, 2021
@ghost
Copy link

ghost commented Feb 23, 2021

🎉 This issue was addressed in 2051, which has now been successfully released in v2.2.0-beta2. 🎉

@ghost
Copy link

ghost commented Feb 23, 2021

🎉 v2.2.0-beta2 has been released which incorporates this pull request. 🎉

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

Successfully merging a pull request may close this issue.

1 participant