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

_editGroupStart is not properly set when go back to history #1518

Closed
isti115 opened this issue May 12, 2020 · 1 comment · Fixed by #1526
Closed

_editGroupStart is not properly set when go back to history #1518

isti115 opened this issue May 12, 2020 · 1 comment · Fixed by #1526
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation.

Comments

@isti115
Copy link

isti115 commented May 12, 2020

I am so used to moving word by word in PowerShell under windows, that I keep pressing Ctrl+Left and Ctrl+Right under linux as well, which at some point resulted in the following message asking me to report this here:

Environment

PSReadLine: 2.0.0
PowerShell: 7.0.0
OS: Linux 5.6.8-arch1-1 #1 SMP PREEMPT Wed, 29 Apr 2020 16:22:56 +0000
Last 200 Keys

 Enter
 v i m Spacebar Backspace Backspace Backspace Backspace Backspace v i m Spacebar . Backspace Backspace Backspace Backspace Backspace Backspace v i m Spacebar Backspace Backspace Backspace Backspace c p Spacebar c o Tab B Tab Spacebar c o Tab B Tab Backspace Backspace Backspace Backspace l a g d a Enter
 v i m Spacebar c o Tab B Tab Backspace Backspace Backspace Backspace l Tab Enter
 v i m Spacebar - s Spacebar t e x t Backspace Backspace s t . v i m Spacebar - c Spacebar " " LeftArrow w g Backspace q RightArrow LeftArrow LeftArrow LeftArrow : RightArrow End Spacebar c o Tab B Tab Backspace Backspace Backspace Backspace l a g d a Enter
 v i m UpArrow UpArrow Enter
 UpArrow LeftArrow UpArrow UpArrow UpArrow UpArrow DownArrow DownArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow RightArrow Backspace Enter
 UpArrow UpArrow Enter
 UpArrow Enter
 UpArrow UpArrow Home RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow Backspace Backspace Backspace Delete Spacebar _ Backspace " Escape 1 ; 5 C UpArrow UpArrow DownArrow UpArrow Home RightArrow RightArrow RightArrow RightArrow RightArrow RightArrow Escape

Exception

System.ArgumentOutOfRangeException: Non-negative number required. (Parameter 'count')
   at System.Collections.Generic.List`1.GetRange(Int32 index, Int32 count)
   at Microsoft.PowerShell.PSConsoleReadLine.EndEditGroup(Action`2 instigator, Object instigatorArg)
   at Microsoft.PowerShell.PSConsoleReadLine.GroupUndoHelper.EndGroup()
   at Microsoft.PowerShell.PSConsoleReadLine.ViCommandMode(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)
@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label May 12, 2020
@daxian-dbw daxian-dbw changed the title Something went wrong (probably because of ctrl+arrow keys?) _editGroupStart is not properly set when go back to history May 14, 2020
@daxian-dbw
Copy link
Member

Here is the repro:

  1. Make sure you are in VI edit mode.
  2. Type cls and then press Enter
  3. Type ok and then press Enter
  4. Type abcdef and then press Escape to switch to Command mode
  5. Press Shift+c which will delete the character f
  6. Press UpArrow to get to the history entry ok
  7. Press Escape to switch to Command mode.

the root cause is _editGroupStart is not reset when switching to a history item.

@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.

2 participants