micro-editor / micro-editor/micro

Tilde/Home paths are incompatible with filename completion on windows

Open
#3,828 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
29.6k
Forks
1.4k
Avg merge
2d 18h
Merged PRs (30d)
10

Description

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in internal/util/util.go at the homeString path handling and compare it with the separator logic in internal/buffer/autocomplete.go. Reproduce the listed Windows completion and opening cases, then verify that both forward- and backslash-separated home paths work consistently.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.