Skip to content

Prediction Feature is broken for current line whenever the S command of vi EditMode is used (to clear line) #2408

Closed

Description

Searched for anything related to S command of vi EditMode breaking Prediction but didn't find anything. Sorry it that's a duplicate even so.

Environment

I've reproduced the error on both environments below, both with the native PSReadline version (2.1, I believe) and after upgrading it to the beta version:

PS version: 7.1.3
PSReadline version: 2.2.0-beta2
os: 10.0.19041.320 (WinBuild.160101.0800)
PS file version: 7.1.3.0
HostName: ConsoleHost (Windows Terminal)
BufferWidth: 237
BufferHeight: 61

PS version: 7.1.3
PSReadline version: 2.2.0-beta2
os: Linux ABELHA1674 4.19.128-microsoft-standard #1 SMP Tue Jun 23 12:58:10 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
PS file version: 7.1.3.0
HostName: ConsoleHost
BufferWidth: 237
BufferHeight: 61

Exception report

No exception, I'm afraid.

Steps to reproduce

Set VI Edit mode:

Set-PSReadlineOption -EditMode vi

Set History as PredictionSource

Set-PSReadLineOption -PredictionSource History

Write anything, then press ESC and S (to clear whole line)
Try to use prediction on the cleared line (such as typing Set-PSRead and pressing righ to accept suggestion)

Expected behavior

The suggestion is accepted just as it happens on a new line (without using the S to clear the line before)

Actual behavior

Instead of accepting the suggestion it appers to not do anything at all (visually) and if you stay on the edit mode it really does nothing. But if you press right (to accept the suggestion), then ESC to go to normal mode it skips to the end of the line (to where it would go if it had accepted the suggestion) without visually including the suggestion and if you press enter it will run the suggestion. If you type right then ESC then start typing again, eventually it updates visually as well (including the suggestion and what you just typed).

If you discard or run that line the next line works as expected as long as you don't run the "S" command again - so for now my workaround has been to use "S" followed by Enter to create new line (which is quite a pain).

Summary

The Prediction feature breaks whenever you clear the line (at least with the S command of vi EditMode). Creating new line whenever that happens seems to "fix" it.

Activity

  1. ghost added
    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.
    on Apr 29, 2021
  2. added
    Issue-BugIt either shouldn't be doing this or needs an investigation.
    and removed
    Needs-Triage 🔍It's a new issue that core contributor team needs to triage.
    on Apr 30, 2021
  3. ghost added
    In-PRA PR is opened targeting the issue
    on Sep 22, 2021
  4. ghost removed
    In-PRA PR is opened targeting the issue
    on Sep 22, 2021
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

    Issue-BugIt either shouldn't be doing this or needs an investigation.Resolution-Fixed

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions