Autocomplete begins autocompletion
()
| 190 | |
| 191 | // Autocomplete begins autocompletion |
| 192 | func (h *InfoPane) CommandComplete() { |
| 193 | b := h.Buf |
| 194 | if b.HasSuggestions { |
| 195 | b.CycleAutocomplete(true) |
| 196 | return |
| 197 | } |
| 198 | |
| 199 | c := b.GetActiveCursor() |
| 200 | l := b.LineBytes(0) |
| 201 | l = util.SliceStart(l, c.X) |
| 202 | |
| 203 | args := bytes.Split(l, []byte{' '}) |
| 204 | cmd := string(args[0]) |
| 205 | |
| 206 | if h.PromptType == "Command" { |
| 207 | if len(args) == 1 { |
| 208 | b.Autocomplete(CommandComplete) |
| 209 | } else if action, ok := commands[cmd]; ok { |
| 210 | if action.completer != nil { |
| 211 | b.Autocomplete(action.completer) |
| 212 | } |
| 213 | } |
| 214 | } else { |
| 215 | // by default use filename autocompletion |
| 216 | b.Autocomplete(buffer.FileComplete) |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | // ExecuteCommand completes the prompt |
| 221 | func (h *InfoPane) ExecuteCommand() { |
nothing calls this directly
no test coverage detected