Skip to content

Commit

Permalink
Let edit.completion embed edit.compl.
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaq committed Feb 13, 2017
1 parent 18c06f6 commit 79350d7
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions edit/completion.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,8 @@ import (
// Interface.

type completion struct {
completer string
begin, end int
candidates []*candidate
compl
completer string

filtering bool
filter string
Expand Down Expand Up @@ -156,13 +155,13 @@ func startCompletionInner(ed *Editor, acceptPrefix bool) {
return
}

c := &completion{begin: -1}
c := &completion{}
shownError := false
for _, item := range completers {
compl, err := item.completer(node, ed.evaler)
if compl != nil {
c.completer = item.name
c.begin, c.end, c.candidates = compl.begin, compl.end, compl.candidates
c.compl = *compl
c.filtered = c.candidates
break
} else if err != nil && err != errCompletionUnapplicable {
Expand All @@ -172,7 +171,7 @@ func startCompletionInner(ed *Editor, acceptPrefix bool) {
}
}

if c.begin < 0 {
if c.completer == "" {
if !shownError {
ed.addTip("unsupported completion :(")
}
Expand Down

0 comments on commit 79350d7

Please sign in to comment.