Get-PSReadLineOption emits the ListView window-size warning, so prompt modules trigger it on every shell start
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by locating GetPSReadLineOption.EndProcessing and WarnWhenWindowSizeTooSmallForView, which the issue identifies as the warning path. Reproduce the behavior with the provided Set-PSReadLineOption and Get-PSReadLineOption commands at a 49x20 window size. Done means reading options no longer writes the warning, while opting into ListView still warns when appropriate.
Written by the indexing model from the issue text.
Description
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
N/A
Screenshot
N/A - the console output is pasted verbatim under Actual behavior.
Environment data
PS Version: 7.6.5
PS HostName: ConsoleHost
PSReadLine Version: 2.4.5
PSReadLine EditMode: Windows
OS: 10.0.26100.8875 (WinBuild.160101.0800)
BufferWidth: 49
BufferHeight: 20
Steps to reproduce
[Console]::SetWindowSize(49, 20) # anything below 50 columns or 5 rows
[Console]::SetBufferSize(49, 20)
Set-PSReadLineOption -PredictionViewStyle ListView -WarningAction SilentlyContinue
Get-PSReadLineOption | Out-Null
Get-PSReadLineOption | Out-Null
Where I actually ran into it: oh-my-posh's PowerShell init reads the options once when its module loads, to back up the prompt settings it is about to replace (omp.ps1):
$originalPSReadLineOptions = Get-PSReadLineOption
An editor terminal is often still below the threshold at the moment the profile runs - I hit this in Zed on Windows, where the pty is created before the terminal dock has been laid out. So the warning shows up on shell start: once for that read, and again for my own Set-PSReadLineOption -PredictionViewStyle ListView in the profile.
Expected behavior
Get-PSReadLineOption reads configuration, so it should return the options without writing to the warning stream. Set-PSReadLineOption -PredictionViewStyle ListView already warns at the point where the user opts in, which is where the advice is actionable.
Actual behavior
Every call warns, for as long as ListView is the active view style and the window is below 50x5:
WindowWidth = 49, WindowHeight = 20
PredictionViewStyle is now: ListView
-- calling Get-PSReadLineOption --
WARNING: The prediction 'ListView' is temporarily disabled because the current window size of the console is too small. To use the 'ListView', please make sure the 'WindowWidth' is not less than '50' and the 'WindowHeight' is not less than '5'.
-- calling it again --
WARNING: The prediction 'ListView' is temporarily disabled because the current window size of the console is too small. To use the 'ListView', please make sure the 'WindowWidth' is not less than '50' and the 'WindowHeight' is not less than '5'.
Two things that make it awkward to live with:
- It also fires with
PredictionSource = None, where nothing is predicted at all and the view style has no effect. -WarningActionand$WarningPreferencebelong to the caller. Here the caller is the prompt module, so the person who chose ListView cannot turn it off without redirecting the warning stream around somebody else's init script.
GetPSReadLineOption.EndProcessing has called WarnWhenWindowSizeTooSmallForView since ListView was added in #1909, so I assume it is deliberate. If you want to keep telling people on read, warning once and re-arming when the window grows back would remove the noise on its own. If you would rather drop it from the read path, that is a one-line change. Happy to send a PR for whichever you prefer.
- Dominant language
- C#
- Stars
- 4.4k
- Forks
- 341
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from PowerShell/PSReadLine
-
Needs-Triage :mag:
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
Difficulty 1/5 Under an hour Newbie friendliness 68/100
PowerShell/PSReadLine#3470 · 3 reactions ·
-
Needs-Triage :mag:
Difficulty 3/5 1-2 days Newbie friendliness 55/100
PowerShell/PSReadLine#5214 ·
All issues in PowerShell/PSReadLine
Similar issues
-
bug
Difficulty 1/5 Under an hour Newbie friendliness 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
azurenoops/spin_agent#975 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
SubtitleEdit/subtitleedit#15108 · 1 comment ·