import (
"bytes"
+ "sort"
"strings"
"github.com/zyedidia/micro/cmd/micro/buffer"
}
}
+ sort.Strings(suggestions)
completions := make([]string, len(suggestions))
for i := range suggestions {
completions[i] = util.SliceEndStr(suggestions[i], c.X-argstart)
}
}
+ sort.Strings(suggestions)
completions := make([]string, len(suggestions))
for i := range suggestions {
completions[i] = util.SliceEndStr(suggestions[i], c.X-argstart)
}
}
+ sort.Strings(suggestions)
completions := make([]string, len(suggestions))
for i := range suggestions {
completions[i] = util.SliceEndStr(suggestions[i], c.X-argstart)
}
}
}
+ sort.Strings(suggestions)
completions := make([]string, len(suggestions))
for i := range suggestions {
"CursorDown": (*InfoPane).CursorDown,
"InsertNewline": (*InfoPane).InsertNewline,
"InsertTab": (*InfoPane).InsertTab,
+ "OutdentLine": (*InfoPane).CycleBack,
"Escape": (*InfoPane).Escape,
"Quit": (*InfoPane).Quit,
"QuitAll": (*InfoPane).QuitAll,
func (h *InfoPane) InsertTab() {
b := h.Buf
if b.HasSuggestions {
- b.CycleAutocomplete()
+ b.CycleAutocomplete(true)
return
}
}
}
}
+func (h *InfoPane) CycleBack() {
+ if h.Buf.HasSuggestions {
+ h.Buf.CycleAutocomplete(false)
+ }
+}
func (h *InfoPane) InsertNewline() {
if !h.HasYN {
h.DonePrompt(false)
"bytes"
"io/ioutil"
"os"
+ "sort"
"strings"
"unicode/utf8"
return
}
b.CurSuggestion = -1
- b.CycleAutocomplete()
+ b.CycleAutocomplete(true)
}
-func (b *Buffer) CycleAutocomplete() {
+func (b *Buffer) CycleAutocomplete(forward bool) {
prevSuggestion := b.CurSuggestion
- b.CurSuggestion++
- if b.CurSuggestion >= len(b.Suggestions) || b.CurSuggestion < 0 {
+ if forward {
+ b.CurSuggestion++
+ } else {
+ b.CurSuggestion--
+ }
+ if b.CurSuggestion >= len(b.Suggestions) {
b.CurSuggestion = 0
+ } else if b.CurSuggestion < 0 {
+ b.CurSuggestion = len(b.Suggestions) - 1
}
c := b.GetActiveCursor()
}
}
+ sort.Strings(suggestions)
completions := make([]string, len(suggestions))
for i := range suggestions {
var complete string