diff --git a/complete.go b/complete.go index ea6b7a2..7652f50 100644 --- a/complete.go +++ b/complete.go @@ -214,7 +214,6 @@ func (o *opCompleter) CompleteRefresh() { if inSelect { buf.WriteString("\033[30;47m") } - buf.WriteString(string(same)) buf.WriteString(string(c)) buf.WriteString("\n") diff --git a/completers/complete_long_short.go b/completers/complete_long_short.go index 1d12ecc..81225ca 100644 --- a/completers/complete_long_short.go +++ b/completers/complete_long_short.go @@ -85,7 +85,15 @@ func doLongShortInternal(p LongShortCompleter, line []rune, pos int, origLine [] newLine = append(newLine, []rune{' '}) } } else { - newLine = append(newLine, []rune(fmt.Sprintf("%s\t%s", childName, string(child.Text)))) + if long { + newLine = append(newLine, []rune(fmt.Sprintf("%s\t\t%s", childName, string(child.Text)))) + } else { + if newLine == nil { + newLine = [][]rune{[]rune(childName)} + } else { + newLine[0] = []rune(fmt.Sprintf("%s\t%s", string(newLine[0]), childName)) + } + } } offset = len(childName) lineCompleter = child @@ -95,8 +103,15 @@ func doLongShortInternal(p LongShortCompleter, line []rune, pos int, origLine [] // check if whole line matches a child if runes.HasPrefix([]rune(childName), line) { // the entire line already matches a child - // newLine = append(newLine, []rune(childName[len(line):])) - newLine = append(newLine, []rune(fmt.Sprintf("%s\t\t%s", childName[len(line):], string(child.Text)))) + if long { + newLine = append(newLine, []rune(fmt.Sprintf("%s\t\t%s", childName[len(line):], string(child.Text)))) + } else { + if newLine == nil { + newLine = [][]rune{[]rune(childName)} + } else { + newLine[0] = []rune(fmt.Sprintf("%s\t%s", string(newLine[0]), childName)) + } + } offset = len(line) lineCompleter = child