mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-24 17:50:15 +09:00
Sort suggestions and cycle back
This commit is contained in:
@@ -2,6 +2,7 @@ package action
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/zyedidia/micro/cmd/micro/buffer"
|
||||
@@ -25,6 +26,7 @@ func CommandComplete(b *buffer.Buffer) ([]string, []string) {
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(suggestions)
|
||||
completions := make([]string, len(suggestions))
|
||||
for i := range suggestions {
|
||||
completions[i] = util.SliceEndStr(suggestions[i], c.X-argstart)
|
||||
@@ -47,6 +49,7 @@ func HelpComplete(b *buffer.Buffer) ([]string, []string) {
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(suggestions)
|
||||
completions := make([]string, len(suggestions))
|
||||
for i := range suggestions {
|
||||
completions[i] = util.SliceEndStr(suggestions[i], c.X-argstart)
|
||||
@@ -101,6 +104,7 @@ func OptionComplete(b *buffer.Buffer) ([]string, []string) {
|
||||
}
|
||||
}
|
||||
|
||||
sort.Strings(suggestions)
|
||||
completions := make([]string, len(suggestions))
|
||||
for i := range suggestions {
|
||||
completions[i] = util.SliceEndStr(suggestions[i], c.X-argstart)
|
||||
@@ -185,6 +189,7 @@ func OptionValueComplete(b *buffer.Buffer) ([]string, []string) {
|
||||
}
|
||||
}
|
||||
}
|
||||
sort.Strings(suggestions)
|
||||
|
||||
completions := make([]string, len(suggestions))
|
||||
for i := range suggestions {
|
||||
|
||||
@@ -151,6 +151,7 @@ var InfoOverrides = map[string]InfoKeyAction{
|
||||
"CursorDown": (*InfoPane).CursorDown,
|
||||
"InsertNewline": (*InfoPane).InsertNewline,
|
||||
"InsertTab": (*InfoPane).InsertTab,
|
||||
"OutdentLine": (*InfoPane).CycleBack,
|
||||
"Escape": (*InfoPane).Escape,
|
||||
"Quit": (*InfoPane).Quit,
|
||||
"QuitAll": (*InfoPane).QuitAll,
|
||||
@@ -165,7 +166,7 @@ func (h *InfoPane) CursorDown() {
|
||||
func (h *InfoPane) InsertTab() {
|
||||
b := h.Buf
|
||||
if b.HasSuggestions {
|
||||
b.CycleAutocomplete()
|
||||
b.CycleAutocomplete(true)
|
||||
return
|
||||
}
|
||||
|
||||
@@ -186,6 +187,11 @@ func (h *InfoPane) InsertTab() {
|
||||
}
|
||||
}
|
||||
}
|
||||
func (h *InfoPane) CycleBack() {
|
||||
if h.Buf.HasSuggestions {
|
||||
h.Buf.CycleAutocomplete(false)
|
||||
}
|
||||
}
|
||||
func (h *InfoPane) InsertNewline() {
|
||||
if !h.HasYN {
|
||||
h.DonePrompt(false)
|
||||
|
||||
Reference in New Issue
Block a user