desertbit/grumble

Tab Completion: Add one more whitespace

skaldesh opened this issue · 2 comments

If by pressing Tab a command can be completed, and this command is not a prefix for another command, add one more whitespace to the result, to allow for quick completion of the next.

Example:

  • commands: "Command1", "OtherCommand" -> user types "Comm" -> hits Tab -> "Command1 " (! mind the whitespace)
  • commands: "Command1", "Command2" -> user types "Comm" -> hits Tab -> "Command" (! no whitespace, as multiple results possible)

In completer.go line 133, I found this:

// If a single full match was found, then append a space.
if len(suggestions) == 0 && fullMatch != nil && fullMatchCount == 1 {
	suggestions = append(suggestions, []rune(" "))
}

So, this feature was intended to work already, but does not. Labeling as bug

r0l1 commented

That line appends a space if tab is pressed once more. Maybe append the completion suggestions with a space to fix this?