Add command autocompletion for toggle
This commit is contained in:
		@@ -56,3 +56,16 @@ func autocompleteFile(cmd *CommandAutocomplete) (completions []string, newText s
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func autocompleteToggle(cmd *CommandAutocomplete) (completions []string, newText string) {
 | 
			
		||||
	completions = make([]string, 0, len(toggleMsg))
 | 
			
		||||
	for k := range toggleMsg {
 | 
			
		||||
		if (strings.HasPrefix(k, cmd.RawArgs)) {
 | 
			
		||||
			completions = append(completions, k)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if len(completions) == 1 {
 | 
			
		||||
		newText = fmt.Sprintf("/%s %s", cmd.OrigCommand, completions[0])
 | 
			
		||||
	}
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -122,6 +122,7 @@ func NewCommandProcessor(parent *MainView) *CommandProcessor {
 | 
			
		||||
			"import":        autocompleteFile,
 | 
			
		||||
			"export":        autocompleteFile,
 | 
			
		||||
			"export-room":   autocompleteFile,
 | 
			
		||||
			"toggle":        autocompleteToggle,
 | 
			
		||||
		},
 | 
			
		||||
		commands: map[string]CommandHandler{
 | 
			
		||||
			"unknown-command": cmdUnknownCommand,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user