micro-editor / micro-editor/micro

Open Command Misusing '\n' In Paths

Open
#2,449 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

Description of the problem or steps to reproduce

Note: while this issue is present in Linux, it's really only a problem in Windows, as using tab to auto-complete path segments terminates directories with back-slashes.

When trying to open a path in which a sub-directory's name starts with a lowercase 'n', the preceding backslash is dropped, and--consequently--the wrong file path is used.

Using forward-slashes avoids the issue, but is a huge pain, as tab-completion uses back-slashes and won't work after a forward-slash. So if you auto-complete the path, it must then be manually modified.

Specifications

Using the command open abc\nothing results in opening the file abcnothing
Using forward-slashes or capital N's works as expected: open abc/nothing results in abc/nothing and open abc\Nothing results in abc\Nothing

I assume this issue has to do with '\n' corresponding to the newline character. Although, I would have thought both the back-slash and the 'n' would have been dropped, so perhaps not.

Commit hash: b9763856
OS: Windows 10 Pro
Terminal: Windows Terminal Preview - Powershell

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

Reproduce the issue with the open command on Windows using abc\nothing, then compare it with forward slashes and an uppercase N. Start by tracing the open command's path handling and the treatment of backslash-n sequences; done means tab-completed Windows paths beginning with \n open the intended file without manual edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.