Console corruption on Unix PTYs when completion wraps near bottom row (stale _initialY drift)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Reproduce the completion wrapping scenario with an 80x24 Unix PTY, then read Render.cs and the redraw path around SetCursorPosition(_initialX, _initialY). Compare renders as candidates wrap, scroll, and shrink. Done means cycling completions no longer overwrites prior command history and the prompt remains correctly positioned after terminal scrolling.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Environment
PS version: 7.4.19
PSReadline version: 2.3.6
os: Linux localhost 6.1.141-android14-11-o-gf61012bbfa24 #1 SMP PREEMPT Mon Aug 10 12:44:35 UTC 2026 aarch64 Android
PS file version: 7.4.19.0
HostName: ConsoleHost
BufferWidth: 80
BufferHeight: 24
Exception report
N/A (no crash or exception thrown; visual/screen corruption occurs).
Steps to reproduce
- In a terminal with standard dimensions (e.g. 24 rows, 80 columns), run several commands (e.g.
1..15 | ForEach-Object { "line $_" }) so that output fills the screen and the prompt sits at or near the bottom row. - Type a command with long paths or multiple completion candidates (e.g.
Get-ChildItem /data/data/com.termux/files/usr/or deep directories). - Press
Tabto cycle completions so that completion candidates expand across multiple physical lines and wrap past the bottom row. - Continue pressing
Tabto cycle through candidates of varying lengths (wrapping and unwrapping).
Expected behavior
When completions wrap across multiple lines at the bottom of the screen, the terminal should scroll naturally and continue drawing downward into new lines without overwriting prior console history.
Actual behavior
As Tab cycles between candidates of different lengths:
- Writing past the bottom row forces the terminal emulator to physically scroll lines upward.
- Redrawing the prompt and candidate appears to calculate against the pre-scroll prompt anchor (
_initialY), emitting absolute ANSI cursor coordinates (\e[row;colH) that land above the actual prompt position. - The prompt and new input progressively walk up the screen, drawing directly on top of earlier command outputs and history.
- The screen remains corrupted until cleared with
Clear-Host/cls.
Root cause analysis / Technical notes
On Unix-like platforms (.NET Core PTY), Console.BufferHeight equals Console.WindowHeight. When a multi-line input forces the terminal to scroll lines upward:
- Physical lines shift up into the terminal emulator's scrollback buffer.
- In
Render.cs, redraws position the cursor using absolute coordinates viaSetCursorPosition(_initialX, _initialY). - When subsequent renders are shorter (or when cycling between long and short completion candidates), positioning to
_initialYplaces the cursor over earlier content that shifted into that row slot. - Unix shells (GNU Readline, ZLE, Fish) avoid this by navigating relatively (
\e[A,\e[B,\r) rather than using absolute row addressing.
- Vorherrschende Sprache
- C#
- Sterne
- 4.4k
- Forks
- 341
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus PowerShell/PSReadLine
-
Needs-Triage :mag:
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 68/100
PowerShell/PSReadLine#3470 · 3 Reaktionen ·
Alle Issues in PowerShell/PSReadLine
Ähnliche Issues
-
agentic-workflows area/Docs partner/agentic-workflows
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
microsoft/fluentui-blazor#5364 ·
Maintainer antworten meist innerhalb von 1 Tag
-
.NET triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
microsoft/agent-framework#8811 ·
Maintainer antworten meist innerhalb von 1 Tag
-
.NET Docs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 82/100
getsentry/sentry-dotnet#5637 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
QuantConnect/Lean#9842 ·
Maintainer antworten meist innerhalb von 1 Tag