Skip to content

Input issue when setting custom prompt #849

Closed

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)>

Activity

  1. neur0manc commented on Jan 30, 2019

    @neur0manc
    Author

    Running on Fedora 29

  2. neur0manc commented on Jan 30, 2019

    @neur0manc
    Author

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

  3. neur0manc commented on Jan 30, 2019

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

  4. daxian-dbw commented on Jul 18, 2019

    @daxian-dbw
    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).

  5. daxian-dbw commented on Sep 13, 2019

    @daxian-dbw
    Member

    Fixed by #979 and #967

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    OutOfRangeIssues relating to System.ArgumentOutOfRangeException

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions