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

Unable to use Invoke-FuzzyEdit to edit file with CLI text editor #242

Open
ilvon opened this issue Jan 11, 2024 · 2 comments
Open

Unable to use Invoke-FuzzyEdit to edit file with CLI text editor #242

ilvon opened this issue Jan 11, 2024 · 2 comments

Comments

@ilvon
Copy link

ilvon commented Jan 11, 2024

I am now using Powershell 7.4.0.
I set the environment variable of editor to "nano" with $env:editor = "nano"
When I tried to use Invoke-FuzzyEdit / by using the alias fe, not only that I cannot use nano to edit the file, but it also turn my terminal behave weird (shown as the following gif)
This also happen if i modify the PSFzf.psm1 file to allow using another command-line text editor "micro" for the editor launch option for Invoke-FuzzyEdit

*gif that showing the above weird behavior
e

Furthermore, if the selected directory path from Invoke-FuzzyEdit contains spacing, the editor cannot open it successfully because of it.
p

I guess the issue caused by path with spacing can be fixed by adding double quote to the path in Get-EditorLaunch()

function Get-EditorLaunch() {

    ...

    elseif ($editor -eq 'nano') {
        ...
        else {
            "$editor$editorOptions  +{1} ""{0}""" -f $(Resolve-Path $FileList.Trim('"')), $LineNum  #<----- this line
        }
    }
@ilvon ilvon changed the title Unable to use Invoke-FuzzyEdit to edit file with TUI text editor Unable to use Invoke-FuzzyEdit to edit file with CLI text editor Jan 11, 2024
kelleyma49 added a commit that referenced this issue Jan 21, 2024
@kelleyma49
Copy link
Owner

I couldn't recreate the rendering issues you're seeing, but it might be a race condition where fzf hasn't been killed.

I do have a fix for the path with spaces issue (#243)

kelleyma49 added a commit that referenced this issue Jan 21, 2024
@ilvon
Copy link
Author

ilvon commented Jan 22, 2024

For more information, I am using Powershell 7.4.1 (just upgraded few days ago) + Windows Terminal 1.18.3181.0 + fzf 0.45.0 + nano 7.2-1 (from msys2) + PSReadLine 2.3.4 .
I also tried to disable other unnecessary module from Powershell and with a blank pwsh profile, such rendering issue still exist.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants