[X] Search the existing issues, especially the pinned issues.
Exception report
### Environment
PSReadLine: 2.3.5+2cc85806c561a9395751a96a818e8ff1592d19f7
PowerShell: 7.4.5
OS: Microsoft Windows 10.0.19045
BufferWidth: 106
BufferHeight: 1
Last 1 Keys:
Ctrl+r
### Exception
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Text.StringBuilder.get_Chars(Int32 index)
at Microsoft.PowerShell.PSConsoleReadLine.ConvertOffsetToPoint(Int32 offset)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Render()
at Microsoft.PowerShell.PSConsoleReadLine.InteractiveHistorySearch(Int32 direction)
at Microsoft.PowerShell.PSConsoleReadLine.ReverseSearchHistory(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Bool
ean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics
, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
It could be a tab or pane with any amount of history (including no history). If using a tab instead of a pane, you'd just need to resize the whole window instead. After pressing Ctrl+r, it also doesn't make a difference what is typed before pressing enter. If, after pressing Ctrl+r, the pane is resized to not be the minimum, it will still have the same error.
If you press Ctrl+r first at a normal size, then resize to a height of 1, then press the Enter key, it will raise a different exception:
System.ArgumentOutOfRangeException: The value must be greater than or equal to zero and less than the cons
ole's buffer size in that dimension. (Parameter 'top')
Actual value was 2.
at System.ConsolePal.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.Internal.VirtualTerminal.SetCursorPosition(Int32 left, Int32 top)
at Microsoft.PowerShell.PSConsoleReadLine.CalculateWhereAndWhatToRender(Boolean cursorMovedToInitialPos
, RenderData renderData, LineInfoForRendering& lineInfoForRendering)
at Microsoft.PowerShell.PSConsoleReadLine.ReallyRender(RenderData renderData, String defaultColor)
at Microsoft.PowerShell.PSConsoleReadLine.ForceRender()
at Microsoft.PowerShell.PSConsoleReadLine.Render()
at Microsoft.PowerShell.PSConsoleReadLine.RenderWithPredictionQueryPaused()
at Microsoft.PowerShell.PSConsoleReadLine.ClearStatusMessage(Boolean render)
at Microsoft.PowerShell.PSConsoleReadLine.InteractiveHistorySearch(Int32 direction)
at Microsoft.PowerShell.PSConsoleReadLine.ReverseSearchHistory(Nullable`1 key, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.ProcessOneKey(PSKeyInfo key, Dictionary`2 dispatchTable, Bool
ean ignoreIfNoAction, Object arg)
at Microsoft.PowerShell.PSConsoleReadLine.InputLoop()
at Microsoft.PowerShell.PSConsoleReadLine.ReadLine(Runspace runspace, EngineIntrinsics engineIntrinsics
, CancellationToken cancellationToken, Nullable`1 lastRunStatus)
Expected behavior
I expect it to work like bck-i-search normally does.
Actual behavior
The above exception happens, and it doesn't search the command history either.
For example, if I open a new instance of PowerShell and type in test, then do Ctrl+r to initiate reverse i search, then type in t and press enter, it would normally say, "the term 'test' is not recognized ..." (as it should). If the buffer height is 1, it instead says, "the term 't' is not recognized ...".
Prerequisites
Exception report
Screenshot
Environment data
Steps to reproduce
Minimum reproducible example:
It could be a tab or pane with any amount of history (including no history). If using a tab instead of a pane, you'd just need to resize the whole window instead. After pressing Ctrl+r, it also doesn't make a difference what is typed before pressing enter. If, after pressing Ctrl+r, the pane is resized to not be the minimum, it will still have the same error.
If you press Ctrl+r first at a normal size, then resize to a height of 1, then press the Enter key, it will raise a different exception:
Expected behavior
I expect it to work like bck-i-search normally does.
Actual behavior
The above exception happens, and it doesn't search the command history either. For example, if I open a new instance of PowerShell and type in
test
, then do Ctrl+r to initiate reverse i search, then type int
and press enter, it would normally say, "the term 'test' is not recognized ..." (as it should). If the buffer height is 1, it instead says, "the term 't' is not recognized ...".