diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2022-01-29 19:09:20 +1100 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2022-03-17 19:13:40 +1100 |
commit | 138be04e6575f2bd087630e49d122af578c78bf6 (patch) | |
tree | ed038641d6871e49ff426096f300e6b3b3ab4f1e /pkg/gui/list_context.go | |
parent | 1a74ed32143f826104e1d60f4392d2d8ba53cd80 (diff) |
refactor contexts code
Diffstat (limited to 'pkg/gui/list_context.go')
-rw-r--r-- | pkg/gui/list_context.go | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/pkg/gui/list_context.go b/pkg/gui/list_context.go index e94967ff4..6841dc569 100644 --- a/pkg/gui/list_context.go +++ b/pkg/gui/list_context.go @@ -5,6 +5,7 @@ import ( "github.com/jesseduffield/gocui" "github.com/jesseduffield/lazygit/pkg/config" + "github.com/jesseduffield/lazygit/pkg/gui/context" "github.com/jesseduffield/lazygit/pkg/gui/types" ) @@ -25,7 +26,7 @@ type ListContext struct { Gui *Gui - *BasicContext + *context.BaseContext } var _ types.IListContext = &ListContext{} @@ -46,7 +47,7 @@ func (self *ListContext) FocusLine() { if self.RenderSelection { _, originY := view.Origin() displayStrings := self.GetDisplayStrings(originY, view.InnerHeight()+1) - self.Gui.renderDisplayStringsAtPos(view, originY, displayStrings) + self.Gui.renderDisplayStringsInViewPort(view, displayStrings) } view.Footer = formatListFooter(self.GetPanelState().GetSelectedLineIdx(), self.GetItemsLength()) } @@ -101,16 +102,8 @@ func (self *ListContext) HandleFocusLost() error { } func (self *ListContext) HandleFocus(opts ...types.OnFocusOpts) error { - if self.Gui.popupPanelFocused() { - return nil - } - self.FocusLine() - if self.Gui.State.Modes.Diffing.Active() { - return self.Gui.renderDiff() - } - if self.OnFocus != nil { if err := self.OnFocus(opts...); err != nil { return err |