kelleyma49 / PSFzf

A PowerShell wrapper around the fuzzy finder fzf
MIT License
787 stars 34 forks source link

Result of TAB completion not written to command line #85

Closed f0rdprefect closed 2 years ago

f0rdprefect commented 3 years ago

DO

  1. Open Powershell
  2. Set-PSReadLineKeyHandler -Key Tab -ScriptBlock { Invoke-FzfTabCompletion }
  3. Type something and hit <TAB>
  4. fzf opens and I can type to narrow down matches and select the item I want on the command line
  5. hit <ENTER>

GET

the text I typed to narrow down the list of results

EXPECT

the Item I selected appended to my command line

Remark

Powershell 5.1.17763.1971

Using all other chords like - R work as expected. I guess I am missing something? Anything else I can try?

kelleyma49 commented 3 years ago

TabCompleteIssue

Can you give me more information? I can't see to recreate your issue. See attached gif.

f0rdprefect commented 3 years ago

Can do but I am on extender parental leave. It will be not before end of October...

On Thu, Aug 12, 2021, 08:01 Michael Kelley @.***> wrote:

[image: TabCompleteIssue] https://user-images.githubusercontent.com/2152684/129145854-fa95ba27-9ee0-4528-ac7e-921bd13867ad.gif

Can you give me more information? I can't see to recreate your issue. See attached gif.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/kelleyma49/PSFzf/issues/85#issuecomment-897371321, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABVUW5KWVIFLZKCWAOCF7CDT4NPUVANCNFSM47DDDJXA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

kelleyma49 commented 2 years ago

When you get a chance, try running the following before tab completion:

$error.Clear()

Try the tab completion, then run the following after and post the output:

$error

koalp commented 2 years ago

I have the same issue for and there is no $error.

What I’ve done :

$error.Clear()
$error.Cl<TAB>  # completion menu showing but nothing append after selection in fzf
$error # no output
ghost commented 2 years ago

Confirm tab completion not working here also.

EDIT: Installing the latest version of PowerShell from here and using it instead of the Windows one fixed the issue for me.

redcoreit commented 2 years ago

I'm experiencing this issue as well. $error is empty.

Other information: If I try to set shortcut for a command like Invoke-FuzzyGitStatus then it fails similarly, but it might be another issue.

Name             : ConsoleHost
Version          : 5.1.19041.1151
InstanceId       : 58407a44-9a4c-451d-a21c-338dc8c5723f
UI               : System.Management.Automation.Internal.Host.InternalHostUserInterface
CurrentCulture   : hu-HU
CurrentUICulture : en-US
PrivateData      : Microsoft.PowerShell.ConsoleHost+ConsoleColorProxy
DebuggerEnabled  : True
IsRunspacePushed : False
Runspace         : System.Management.Automation.Runspaces.LocalRunspace
ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     2.2.9      PSFzf                               {Enable-PsFzfAliases, Invoke-FuzzyEdit, Invoke-FuzzyFasd, Invoke-FuzzyGitStatus...}
Script     2.1.0      PSReadline                          {Get-PSReadLineKeyHandler, Get-PSReadLineOption, Remove-PSReadLineKeyHandler, Set-PSReadLineKeyHandler...}
Script     0.7.3      posh-git                            {Add-PoshGitToProfile, Add-SshKey, Enable-GitColors, Expand-GitCommand...}
Script     1.4.3      ZLocation                           {Get-ZLocation, Invoke-ZLocation, Pop-ZLocation, Remove-ZLocation...}
belotn commented 2 years ago

I have 2 version of powershell here (5.1 and 7.2), the issue appears in 5.1 but not in 7.2.

belotn commented 2 years ago

On powershell 5, $script:fzfOuput contains 2 value the selected FZF return and the queried path, on powershell 7 only the result...

image

roachsinai commented 2 years ago

Same issue on powershell 5.

kelleyma49 commented 2 years ago

I see what is happening, but I'm not sure why.

The order of outputs from fzf is inconsistent in PowerShell 5. fzf is supposed to output the query first, then the selections. It does this in PowerShell 7 just fine, but not in 5.

roachsinai commented 2 years ago

@kelleyma49 thanks! It works. But seems it not work with soft link with fuzzyselectdirectory. I will open a new issue.

roachsinai commented 2 years ago

@kelleyma49 thanks! It works. But seems it not work with soft link with fuzzyselectdirectory. I will open a new issue.

Soft link not work is my fault, sorry for that.