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

EndEditGroup doesn't remove undo edits #1523

Closed
daxian-dbw opened this issue May 14, 2020 · 0 comments · Fixed by #1526
Closed

EndEditGroup doesn't remove undo edits #1523

daxian-dbw opened this issue May 14, 2020 · 0 comments · Fixed by #1526
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@daxian-dbw
Copy link
Member

Environment

PSReadLine: 2.1.0-beta1
PowerShell: 7.0.0
OS: Microsoft Windows 10.0.18363
BufferWidth: 133
BufferHeight: 35
Last 195 Keys

 Enter c l s Enter d i r Enter c l s Enter g m o Spacebar p s r e Tab Spacebar | Spacebar % Spacebar p Backspace m o d u l Tab Enter Enter y u Enter b g t h j u Escape LeftArrow LeftArrow Backspace Backspace s e t Backspace Backspace Backspace s e t - p s r e a d Tab Tab Spacebar - v e r Tab Backspace Backspace Backspace Backspace Backspace Backspace Backspace e d i Tab Spacebar v i Tab Enter Enter y u Backspace Backspace Backspace y u Enter b g t h u n Escape LeftArrow C 8 9 0 UpArrow Escape RightArrow RightArrow Enter Enter f a Backspace Backspace Backspace b g t n h u Escape LeftArrow C 8 9 0 UpArrow Escape DownArrow DownArrow UpArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow DownArrow RightArrow RightArrow Enter i o Enter b c d f e f Escape LeftArrow C 9 0 0 UpArrow DownArrow Escape u ` Enter Enter Enter f a Backspace Backspace Backspace Enter y u i o g h Escape LeftArrow C 8 8 8 Ctrl+z Ctrl+z Escape u

Exception

System.IndexOutOfRangeException: Index was outside the bounds of the array.
   at System.Text.StringBuilder.get_Chars(Int32 index)
   at Microsoft.PowerShell.PSConsoleReadLine.EditItemInsertChar.Undo()
   at Microsoft.PowerShell.PSConsoleReadLine.GroupedEdit.Undo()
   at Microsoft.PowerShell.PSConsoleReadLine.Undo(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

  1. Make sure you are in VI edit mode
  2. Type yuiogh and then press Escape to switch to the Command mode
  3. Press Shift+c to remove the last character h
  4. Type 897, then press Ctrl+z to undo the 7 character
  5. Press Escape to switch to Command mode
  6. Press u to undo the last edit group

Expected behavior

The edit group that started since Shift+c should be undone, and yuiogh should be displayed.

Actual behavior

Exception thrown.

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 14, 2020
@daxian-dbw daxian-dbw added Issue-Bug It either shouldn't be doing this or needs an investigation. and removed Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. labels May 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant