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

Tried to abort partially entered command with a Control-C #3830

Closed
3 tasks done
buchs opened this issue Oct 11, 2023 · 6 comments
Closed
3 tasks done

Tried to abort partially entered command with a Control-C #3830

buchs opened this issue Oct 11, 2023 · 6 comments

Comments

@buchs
Copy link

buchs commented Oct 11, 2023

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

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!

### Environment
PSReadLine: 2.2.6
PowerShell: 7.3.8
OS: Microsoft Windows 10.0.19045
BufferWidth: 120
BufferHeight: 52

Last 200 Keys:

 UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow Enter
 p u l u m i Spacebar i m p o r t Spacebar a w s : s e c r e t s m a n a g e r / s e c r e t : S e c r e t Spacebar s e c r e t Spacebar a r n : a w s : s e c r e t s m a n a g e r : u s - e a s t - 1 : <REDACTED> Enter
 p u l u l u Backspace Backspace m i Spacebar s t a c k Spacebar e RightArrow Enter
 UpArrow UpArrow UpArrow Enter
 UpArrow UpArrow UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace Ctrl+c

Screenshot

### Exception

System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the console's buffer size in that dimension. (Parameter 'top')
Actual value was 52.
   at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.CancelLine(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.CopyOrCancelLine(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, Nullable`1 lastRunStatus)

Environment data

PS Version: 7.3.8
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.2.6
PSReadLine EditMode: Windows
OS: 10.0.19041.1 (WinBuild.160101.0800)
BufferWidth: 120
BufferHeight: 52

Steps to reproduce

Paste a command, start deleting text at the end and then press Control-C.

Expected behavior

Cancels command

Actual behavior

Exception thrown

@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 11, 2023
@daxian-dbw
Copy link
Member

Paste a command, start deleting text at the end and then press Control-C.

@buchs I cannot reproduce this issue locally. I pasted the same command shown in your "Last 200 Keys":

pulumi import aws:secretsmanager/secret:Secret secret arn:aws:secretsmanager:us-east-1:

And press Backspace 27 times (same as shown in the "Last 200 Keys"), then press Ctrl+c, and it works fine.
I did try pasting other random command line strings and could not reproduce the issue too.

Can you please provide repro steps that can consistently reproduce the issue? Also, can you also upgrade to the latest 2.3.4 version of PSReadLine and see if you run into the same issue with it?

@daxian-dbw daxian-dbw added Needs-Repro There is no sufficient information on repro steps. Needs-Author Feedback labels Oct 11, 2023
@abatishchev

This comment was marked as outdated.

@daxian-dbw
Copy link
Member

daxian-dbw commented Oct 11, 2023

Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new

@abatishchev You are on a very old version of PSReadLine. This URL was reported only on versions prior to 2.0.0-beta2. The issue you ran into was very likely resolved in recent releases. Please upgrade to the latest 2.3.4 version and try it again.

@buchs
Copy link
Author

buchs commented Oct 12, 2023

@daxian-dbw Sorry, but I have not seen this problem reproduce, so I cannot provide consistent steps. I was just reporting it, as the software requested I do.

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs-Attention 👋 and removed Needs-Author Feedback Needs-Repro There is no sufficient information on repro steps. labels Oct 12, 2023
@daxian-dbw
Copy link
Member

@buchs No worries at all and thanks for reporting it!
We consider all reliability issue like this one to be of high importance, so we really want to reproduce the failure and fix it. It would be very helpful if you can provide some more information about the command lines you were editing when this happened.

The Last 200 Keys contains this line and by looking those keys, the exception happened when you were editing this line (pressing Backspace and then Ctrl+c)

p u l u m i Spacebar i m p o r t Spacebar a w s : s e c r e t s m a n a g e r / s e c r e t : S e c r e t Spacebar s e c r e t Spacebar a r n : a w s : s e c r e t s m a n a g e r : u s - e a s t - 1 : <REDACTED> Enter

A few questions:

  1. Did you resize the terminal window before the exception happened?
    • The environment section shows "BufferWidth: 120; BufferHeight: 52". I assume that you didn't change the terminal window size, but please let me know if you did.
  2. Can you please share the full line the full line of the above typing?
    • By mimicking the keys, the command line seems to be pulumi import aws:secretsmanager/secret:Secret:Secrete secret arn:aws:secretsmanager:us-east-1:, but I don't know what <REDACTED> maps to, so it would be helpful if you can dig your history and provide the actual string of this command line.

With the additional information, I will try again to reproduce the issue locally, and hopefully it will work.

@microsoft-github-policy-service
Copy link
Contributor

This issue is closed because it has been marked as requiring author feedback but has not had any activity for 7 days. If you think the issue is still relevant, please reopen and provide your feedback.

@daxian-dbw daxian-dbw removed the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants