API to get prompt's *starting* Y coordinate, for external tab-completers that must scroll terminal and thus relocate prompt position
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 35/100
Direzione di ricerca
Start by tracing the existing InvokePrompt entry point and PSReadLine's prompt and cursor-position handling. Compare the proposed GetPromptStartPosition and MovePromptYPosition APIs, then define behavior for multiline prompts and terminal scrolling; done means an external completer can restore the prompt using its starting Y coordinate.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Prerequisites
- Write a descriptive title.
Description of the new feature/enhancement
PSFzf exposes an alternative to MenuComplete using fzf's fuzzy matching menu. Just like MenuComplete, fzf's menu requires X lines of space beneath the prompt, so it may scroll the terminal upward when activated. When it returns, PSReadLine needs to be informed that the prompt has moved upward to a different Y position.
When the prompt is multiple lines long, this Y position is not the same as (Get-Host).UI.RawUI.CursorPosition. RawUI shows us the end of the prompt, but not the beginning. The beginning is the value which must be passed to InvokePrompt.
Related issues:
https://github.com/kelleyma49/PSFzf/issues/202#issuecomment-2503800370
https://github.com/kelleyma49/PSFzf/issues/227
Proposed technical implementation details (optional)
There are hacks to compute the prompt height, by overriding function prompt to capture the Y coordinate before the prompt is rendered. But the correct solution is for PSReadLine to expose either:
GetPromptStartPositionto get the Y coordinate of the prompt, so fzf can subtract the number of lines it scrolled the terminal and pass the result toInvokePromptMovePromptYPositionif you really don't want to expose the above. This would accept a positive or negative number and add it to the prompt's Y position.
Pseudo-code to show how this might work:
Set-PSReadLineKeyHandler -Key Tab -ScriptBlock {
$cursor_y = (Get-Host).UI.RawUI.CursorPosition.Y # end of prompt, to account for multi-line prompts
$prompt_y = [PSReadline]::GetPromptStartPosition().Y # start of prompt
InvokeFzfMenu # This may scroll the terminal to make space for the menu, and will thus restore cursor position to a new (higher) Y coordinate when finished
# How much did cursor position move? Add this delta to prompt's start position
$new_prompt_y = $prompt_y + (Get-Host).UI.RawUI.CursorPosition.Y - $cursor_y
[PSReadline]::InvokePrompt($null, $new_prompt_y)
}
- Lingua principale
- C#
- Stelle
- 4.4k
- Fork
- 341
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di PowerShell/PSReadLine
-
Needs-Triage :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
PowerShell/PSReadLine#5205 ·
-
Needs-Triage :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
PowerShell/PSReadLine#5195 ·
-
Needs-Triage :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
PowerShell/PSReadLine#5121 ·
-
Needs-Triage :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 64/100
PowerShell/PSReadLine#5045 ·
-
Area-CommandHelp Issue-Enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 68/100
PowerShell/PSReadLine#3470 · 3 reazioni ·
Tutte le issue di PowerShell/PSReadLine
Issue simili
-
bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 75/100
sillsdev/languageforge-lexbox#2665 ·
-
bug documentation frontend
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
azurenoops/spin_agent#975 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
-
:watch: Not Triaged 11.0 fundamentals/subsvc
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
dotnet/AspNetCore.Docs#37699 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
SubtitleEdit/subtitleedit#15108 · 1 commento ·