Skip to content

Tilde/Home paths are incompatible with filename completion on windows #3828

@ikkierie

Description

@ikkierie

Issue

Tilde paths work on windows, but only using forward slash (/) separated paths.
Filename completion works on windows, but only using backslash (\) separated paths.
This means that autocomplete cannot be used with home-paths on windows, despite the machinery for both being implemented.

Examples

Assuming the file C:\Users\User\foo.txt exists, micro:

  • correctly autocompletes C:\Users\User\foo to C:\Users\User\foo.txt
  • fails to autocomplete C:/Users/User/foo
  • fails to autocomplete ~\foo
  • fails to autocomplete ~/foo

In addition:

  • micro fails to open ~\foo.txt (seemingly attempting to find some user \foo.txt)
  • it does, however, successfully open ~/foo.txt

Proposed Solution:

Update homeString := strings.Split(path, "/")[0] in util.go to use string(os.PathSeparator) instead of "/", as is already the case in autocomplete.go (or vice versa), or otherwise come up with some solution to make both forward and backslashes work in both places on windows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions