Skip to content

Prediction Source "History" does not use all of the PSReadline history #5014

Description

@nebula-it

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

Environment data

PS Version: 7.5.4
PS HostName: ConsoleHost (Windows Terminal)
PSReadLine Version: 2.4.5
PSReadLine EditMode: Windows
OS: 10.0.26100.1 (WinBuild.160101.0800)
BufferWidth: 133
BufferHeight: 38

Steps to reproduce

  1. Set Set-PSReadLineOption -MaximumHistoryCount 200000
  2. Not so sure how to arbitrarily fill the history but you need to ensure your history at (cat (get-psreadLineOption).HistorySavePath | Measure-Object).Count is over 5128
  3. Get the first item from history cat (get-psreadLineOption).HistorySavePath -First 1
  4. Start typing the string from Step 3 in powershell, the history predictor does not show up anything even thought the item is already in PSReadline history

Expected behavior

The step 4 above should show the item from PSReadline history

Actual behavior

The step 4 above does not show the item from PSReadline history. It seems like the last item it will be show is (Current History Count)-5127

Activity

  1. mrenton999 commented on Apr 10, 2026

    @mrenton999

    I have another example of it failing, without having done Set-PSReadLineOption -MaximumHistoryCount

    In this screenshot, on the last command, PSReadline should match on one of the 'New-Alias c cNameFetch' lines in the history file, and suggest the auto-completion; but it does not.
    Image
    There are about 146,361 lines in the file, and in the example given here, that line exists as line 136,549

    When typing 'New-Alias ', an auto-completion for a different line is suggested.
    (gc $BigHistFile).Count
    146361

    Are maybe both of these problems just due to this low (default) setting?
    [PSReadLine seems to me to be scanning further back than 100 commands.]
    (Get-PSReadLineOption).CompletionQueryItems
    100

  2. mrenton999 commented on Apr 10, 2026

    @mrenton999

    Sorry; I found the Set-PSReadLine documentation, and the -CompletionQueryItems is irrelevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions