Skip to content
New issue

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

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

Already on GitHub? # to your account

Input issue when setting custom prompt #849

Closed
neur0manc opened this issue Jan 30, 2019 · 5 comments
Closed

Input issue when setting custom prompt #849

neur0manc opened this issue Jan 30, 2019 · 5 comments
Labels
OutOfRange Issues relating to System.ArgumentOutOfRangeException

Comments

@neur0manc
Copy link

Environment data

PS version: 6.1.2
PSReadline version: 2.0.0-beta3
os: Linux amygdala 4.19.13-300.fc29.x86_64 #1 SMP Sat Dec 29 22:54:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
PS file version:

Steps to reproduce or exception report

  • Set custom prompt function (see below)
  • Type " in prompt
  • Receive error message below

Details

(I removed a backtick from tripple backticks in the error message)

PS /home/stephan> function prompt { $p = Get-Location ; "$env:HOSTNAME ($p)>`n" }
amygdala (/home/stephan)>

amygdala (/home/stephan)>

amygdala (/home/stephan)>
uname
Linux
amygdala (/home/stephan)>
uname -a
Linux amygdala 4.19.13-300.fc29.x86_64 #1 SMP Sat Dec 29 22:54:28 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
amygdala (/home/stephan)>
clear
amygdala (/home/stephan)>

amygdala (/home/stephan)>

amygdala (/home/stephan)>

amygdala (/home/stephan)>

Oops, something went wrong.  Please report this bug with the details below.
Report on GitHub: https://github.com/lzybkr/PSReadLine/issues/new
-----------------------------------------------------------------------
Last 164 Keys:
``
 " " LeftArrow $ e n v : h o s t n a m e Enter
 $ e n v : h o s t n a m e Enter
 G e t - C h i l d i t e m Backspace Backspace Backspace Backspace I t e m Space Backspace Tab Backspace Tab Tab Backspace Backspace Backspace Backspace i t e m Tab Space E n v : Enter
 UpArrow UpArrow Backspace Backspace Backspace Backspace Backspace Backspace Backspace Backspace H O S T N A M E Enter
 UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow UpArrow DownArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow LeftArrow G Backspace $ e n v : H O S
T N A M E Space RightArrow RightArrow RightArrow RightArrow Enter
 Enter
 Enter
 u n a m e Enter
 u n a m e Space - a Enter
 c l e a r Enter
 Enter
 Enter
 Enter
 "
``

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 name: left
Actual value was -2.
   at System.Console.SetCursorPosition(Int32 left, Int32 top)
   at Microsoft.PowerShell.Internal.VirtualTerminal.set_CursorLeft(Int32 value)
   at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
   at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
   at Microsoft.PowerShell.PSConsoleReadLine.Insert(Char c)
   at Microsoft.PowerShell.PSConsoleReadLine.SelfInsert(Nullable`1 key, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(ConsoleKeyInfo key, Dictionary`2 dispatchTable, Boolean ignoreIfNoAction, Object arg)
   at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
   at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics, CancellationToken cancellationToken)
``
-----------------------------------------------------------------------
amygdala (/home/stephan)>
@neur0manc
Copy link
Author

Running on Fedora 29

@neur0manc
Copy link
Author

This is reproducible with the current latest Docker image mcr.microsoft.com/powershell (image id d20d2f556ecf) and the preview image (image id 835086f310b9)

@neur0manc
Copy link
Author

There is no issue when declaring the prompt-function in ~.config/powershell/profile.ps1. Every new invokation of pwsh is with the custom prompt and without this issue.

@daxian-dbw daxian-dbw added this to the 2.0.0-Consider milestone Jun 18, 2019
@joeyaiello joeyaiello added the OutOfRange Issues relating to System.ArgumentOutOfRangeException label Jun 18, 2019
@daxian-dbw
Copy link
Member

This is another instance where the changed prompt produces an extra new line at the end of the prompt message (same as producing a very short prompt message).

@daxian-dbw
Copy link
Member

Fixed by #979 and #967

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
OutOfRange Issues relating to System.ArgumentOutOfRangeException
Projects
None yet
Development

No branches or pull requests

3 participants