@@ -30,6 +30,8 @@ type IListContext interface {
3030 OnRender () error
3131 handlePrevLine () error
3232 handleNextLine () error
33+ handleScrollLeft () error
34+ handleScrollRight () error
3335 handleLineChange (change int ) error
3436 handleNextPage () error
3537 handleGotoTop () error
@@ -69,7 +71,7 @@ func (self *ListContext) FocusLine() {
6971 }
7072
7173 // we need a way of knowing whether we've rendered to the view yet.
72- view .FocusPoint (0 , self .GetPanelState ().GetSelectedLineIdx ())
74+ view .FocusPoint (view . OriginX () , self .GetPanelState ().GetSelectedLineIdx ())
7375 if self .RenderSelection {
7476 _ , originY := view .Origin ()
7577 displayStrings := self .GetDisplayStrings (originY , view .InnerHeight ())
@@ -117,6 +119,13 @@ func (self *ListContext) HandleFocusLost() error {
117119 return self .OnFocusLost ()
118120 }
119121
122+ view , err := self .Gui .g .View (self .ViewName )
123+ if err != nil {
124+ return nil
125+ }
126+
127+ _ = view .SetOriginX (0 )
128+
120129 return nil
121130}
122131
@@ -150,8 +159,44 @@ func (self *ListContext) handleNextLine() error {
150159 return self .handleLineChange (1 )
151160}
152161
162+ func (self * ListContext ) handleScrollLeft () error {
163+ if self .ignoreKeybinding () {
164+ return nil
165+ }
166+
167+ // get the view, move the origin
168+ view , err := self .Gui .g .View (self .ViewName )
169+ if err != nil {
170+ return nil
171+ }
172+
173+ self .Gui .scrollLeft (view )
174+
175+ return self .HandleFocus ()
176+ }
177+
178+ func (self * ListContext ) handleScrollRight () error {
179+ if self .ignoreKeybinding () {
180+ return nil
181+ }
182+
183+ // get the view, move the origin
184+ view , err := self .Gui .g .View (self .ViewName )
185+ if err != nil {
186+ return nil
187+ }
188+
189+ self .Gui .scrollRight (view )
190+
191+ return self .HandleFocus ()
192+ }
193+
194+ func (self * ListContext ) ignoreKeybinding () bool {
195+ return ! self .Gui .isPopupPanel (self .ViewName ) && self .Gui .popupPanelFocused ()
196+ }
197+
153198func (self * ListContext ) handleLineChange (change int ) error {
154- if ! self .Gui . isPopupPanel ( self . ViewName ) && self . Gui . popupPanelFocused () {
199+ if self .ignoreKeybinding () {
155200 return nil
156201 }
157202
@@ -195,7 +240,7 @@ func (self *ListContext) handlePrevPage() error {
195240}
196241
197242func (self * ListContext ) handleClick () error {
198- if ! self .Gui . isPopupPanel ( self . ViewName ) && self . Gui . popupPanelFocused () {
243+ if self .ignoreKeybinding () {
199244 return nil
200245 }
201246
0 commit comments