Skip to content

Commit

Permalink
Expand tilde during autocompletion (#1246)
Browse files Browse the repository at this point in the history
  • Loading branch information
joelim-work authored May 21, 2023
1 parent 346c439 commit 5b934c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion complete.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ func matchFile(s string) (matches []string, longest []rune) {
if isRoot(s) || filepath.Base(s) != s {
name = filepath.Join(filepath.Dir(unescape(s)), f.Name())
}
name = escape(name)
name = escape(replaceTilde(name))

item := f.Name()
if f.Mode().IsDir() {
Expand Down
5 changes: 5 additions & 0 deletions eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -947,6 +947,11 @@ func doComplete(app *app) (matches []string) {

func menuComplete(app *app, dir int) {
if !app.menuCompActive {
toks := tokenize(string(app.ui.cmdAccLeft))
for i, tok := range toks {
toks[i] = replaceTilde(tok)
}
app.ui.cmdAccLeft = []rune(strings.Join(toks, " "))
app.ui.cmdTmp = app.ui.cmdAccLeft
app.menuComps = doComplete(app)
if len(app.menuComps) > 1 {
Expand Down

0 comments on commit 5b934c2

Please sign in to comment.