feat(prediction): support dynamic list height and remove history caps · PowerShell/PSReadLine@9c136e8 · GitHub
Skip to content

Commit 9c136e8

Browse files
feat(prediction): support dynamic list height and remove history caps
Replace hardcoded prediction list limits with user-configurable sizing. Summary: - Remove the fixed 10-line cap and legacy auto-adjustment logic - Prediction list height and capacity now scale based on user settings - History suggestions are no longer artificially capped when plugins are active Key changes: - Convert ListMaxCount and HistoryMaxCount into dynamic properties on PredictionListView - Introduce layout constraints: - PhysicalMax: based on console buffer height (-2 for jitter protection) - PredictionViewHeight: limited by screen space and list capacity - HistoryMaxCount: adjusted to fill the visible view - Remove history cap in AggregateSuggestions (previously limited to 3) Configuration: Add new PSConsoleReadLineOptions properties: - PredictionViewHeight: visible list height - PredictionListCount: total scrollable items - PredictionHistoryCount: history fetch limit Signed-off-by: Konstantin Glukhov <KGlukhov@Hotmail.com>
1 parent 2984546 commit 9c136e8

4 files changed

Lines changed: 84 additions & 11 deletions

File tree

‎PSReadLine/Cmdlets.cs‎

Lines changed: 48 additions & 0 deletions

‎PSReadLine/Options.cs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,18 @@ private void SetOptionsInternal(SetPSReadLineOption options)
2626
{
2727
Options.ContinuationPrompt = options.ContinuationPrompt;
2828
}
29+
if (options._predictionListCount.HasValue)
30+
{
31+
Options.PredictionListCount = options.PredictionListCount;
32+
}
33+
if (options._predictionHistoryCount.HasValue)
34+
{
35+
Options.PredictionHistoryCount = options.PredictionHistoryCount;
36+
}
37+
if (options._predictionViewHeight.HasValue)
38+
{
39+
Options.PredictionViewHeight = options.PredictionViewHeight;
40+
}
2941
if (options._historyNoDuplicates.HasValue)
3042
{
3143
Options.HistoryNoDuplicates = options.HistoryNoDuplicates;

‎PSReadLine/PSReadLine.format.ps1xml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ $d = [Microsoft.PowerShell.KeyHandler]::GetGroupingDescription($_.Group)
111111
<ListItem>
112112
<PropertyName>MaximumHistoryCount</PropertyName>
113113
</ListItem>
114+
<ListItem>
115+
<PropertyName>PredictionViewHeight</PropertyName>
116+
</ListItem>
114117
<ListItem>
115118
<PropertyName>ContinuationPrompt</PropertyName>
116119
</ListItem>

‎PSReadLine/Prediction.Views.cs‎

Lines changed: 21 additions & 11 deletions

0 commit comments

Comments
 (0)