Add more infobar autocomplete

This commit is contained in:
Zachary Yedidia
2019-01-20 19:38:23 -05:00
parent fc7058d47c
commit bc1d6b6f94
3 changed files with 55 additions and 41 deletions

View File

@@ -20,8 +20,7 @@ func (b *Buffer) Autocomplete(c Completer) {
}
// FileComplete autocompletes filenames
func FileComplete(b *Buffer) (string, []string) {
func GetArg(b *Buffer) (string, int) {
c := b.GetActiveCursor()
l := b.LineBytes(c.Y)
l = util.SliceStart(l, c.X)
@@ -36,6 +35,14 @@ func FileComplete(b *Buffer) (string, []string) {
argstart += utf8.RuneCount(a) + 1
}
return input, argstart
}
// FileComplete autocompletes filenames
func FileComplete(b *Buffer) (string, []string) {
c := b.GetActiveCursor()
input, argstart := GetArg(b)
sep := string(os.PathSeparator)
dirs := strings.Split(input, sep)