Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
thomazmoura opened this issue Apr 29, 2021 · 1 comment · Fixed by #2045
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Fixed

Comments

@thomazmoura
Copy link

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.

@ghost ghost added the Needs-Triage 🔍 It's a new issue that core contributor team needs to triage. label Apr 29, 2021
@daxian-dbw daxian-dbw added Issue-Bug It 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. labels Apr 30, 2021
@daxian-dbw daxian-dbw added this to the 2.2.0-Consider milestone Apr 30, 2021
daxian-dbw added a commit to springcomp/PSReadLine that referenced this issue Sep 22, 2021
@ghost ghost added the In-PR A PR is opened targeting the issue label Sep 22, 2021
@ghost ghost added Resolution-Fixed and removed In-PR A PR is opened targeting the issue labels Sep 22, 2021
@ghost
Copy link

ghost commented Oct 28, 2021

🎉 This issue was addressed in 2045, which has now been successfully released in v2.2.0-beta4. 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Bug It either shouldn't be doing this or needs an investigation. Resolution-Fixed
Projects
None yet
2 participants