Repository navigation
Input issue when setting custom prompt #849
Copy link
Copy link
Closed
Labels
OutOfRangeIssues relating to System.ArgumentOutOfRangeExceptionIssues relating to System.ArgumentOutOfRangeException
Milestone
Description
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)>
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
OutOfRangeIssues relating to System.ArgumentOutOfRangeExceptionIssues relating to System.ArgumentOutOfRangeException
Activity
neur0manc commentedon Jan 30, 2019
Running on Fedora 29
neur0manc commentedon Jan 30, 2019
This is reproducible with the current
latestDocker imagemcr.microsoft.com/powershell(image idd20d2f556ecf) and thepreviewimage (image id835086f310b9)neur0manc commentedon Jan 30, 2019
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 commentedon Jul 18, 2019
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 commentedon Sep 13, 2019
Fixed by #979 and #967