]> git.lizzy.rs Git - micro.git/blobdiff - internal/action/infopane.go
better top
[micro.git] / internal / action / infopane.go
index 00dde63350ef86c692688f30076610103c7fa290..2fc5b3ce71c0770fdeb6438f1cfffbfd1dc9f805 100644 (file)
@@ -17,10 +17,10 @@ type InfoPane struct {
        *info.InfoBuf
 }
 
-func NewInfoPane(ib *info.InfoBuf, w display.BWindow) *InfoPane {
+func NewInfoPane(ib *info.InfoBuf, w display.BWindow, tab *Tab) *InfoPane {
        ip := new(InfoPane)
        ip.InfoBuf = ib
-       ip.BufPane = NewBufPane(ib.Buffer, w)
+       ip.BufPane = NewBufPane(ib.Buffer, w, tab)
 
        return ip
 }
@@ -28,7 +28,7 @@ func NewInfoPane(ib *info.InfoBuf, w display.BWindow) *InfoPane {
 func NewInfoBar() *InfoPane {
        ib := info.NewBuffer()
        w := display.NewInfoWindow(ib)
-       return NewInfoPane(ib, w)
+       return NewInfoPane(ib, w, nil)
 }
 
 func (h *InfoPane) Close() {
@@ -73,6 +73,7 @@ func (h *InfoPane) HandleEvent(event tcell.Event) {
        }
 }
 
+// DoKeyEvent executes a key event for the command bar, doing any overridden actions
 func (h *InfoPane) DoKeyEvent(e KeyEvent) bool {
        done := false
        if action, ok := BufKeyBindings[e]; ok {
@@ -85,7 +86,7 @@ func (h *InfoPane) DoKeyEvent(e KeyEvent) bool {
                for s, a := range InfoOverrides {
                        // TODO this is a hack and really we should have support
                        // for having binding overrides for different buffers
-                       if strings.Contains(estr, s) {
+                       if strings.HasPrefix(estr, s) {
                                done = true
                                a(h)
                                break
@@ -122,6 +123,7 @@ var InfoNones = []string{
        "HalfPageDown",
        "ToggleHelp",
        "ToggleKeyMenu",
+       "ToggleDiffGutter",
        "ToggleRuler",
        "JumpLine",
        "ClearStatus",
@@ -154,7 +156,6 @@ var InfoOverrides = map[string]InfoKeyAction{
        "CursorDown":    (*InfoPane).CursorDown,
        "InsertNewline": (*InfoPane).InsertNewline,
        "Autocomplete":  (*InfoPane).Autocomplete,
-       "OutdentLine":   (*InfoPane).CycleBack,
        "Escape":        (*InfoPane).Escape,
        "Quit":          (*InfoPane).Quit,
        "QuitAll":       (*InfoPane).QuitAll,
@@ -196,13 +197,6 @@ func (h *InfoPane) Autocomplete() {
        }
 }
 
-// CycleBack cycles back in the autocomplete suggestion list
-func (h *InfoPane) CycleBack() {
-       if h.Buf.HasSuggestions {
-               h.Buf.CycleAutocomplete(false)
-       }
-}
-
 // InsertNewline completes the prompt
 func (h *InfoPane) InsertNewline() {
        if !h.HasYN {