Merge branch 'devel' into 243-form-demo

This commit is contained in:
Jakub Sobon 2020-11-27 15:13:32 -05:00
commit bb95f538ca
3 changed files with 5 additions and 7 deletions

View File

@ -123,7 +123,8 @@ func (c *Container) hasWidget() bool {
}
// isLeaf determines if this container is a leaf container in the binary tree of containers.
// Only leaf containers are guaranteed to be "visible" on the screen.
// Only leaf containers are guaranteed to be "visible" on the screen, because
// they are on the top of other non-leaf containers.
func (c *Container) isLeaf() bool {
return c.first == nil && c.second == nil
}
@ -331,7 +332,7 @@ func (c *Container) prepareEvTargets(ev terminalapi.Event) (func() error, error)
// Update the focused container based on the pressed key.
// Done after collecting "targets" above. If the key changes which
// widget is focused, they key press itself should go to the widget
// container is focused, they key press itself should go to the widget
// that was focused when the key was pressed.
c.updateFocusFromKeyboard(ev.(*terminalapi.Keyboard))
return func() error {

View File

@ -1548,7 +1548,6 @@ func TestMouse(t *testing.T) {
testcanvas.MustNew(image.Rect(25, 0, 50, 20)),
&widgetapi.Meta{},
widgetapi.Options{WantKeyboard: widgetapi.KeyScopeFocused},
&terminalapi.Keyboard{},
)
return ft
},
@ -1592,7 +1591,6 @@ func TestMouse(t *testing.T) {
testcanvas.MustNew(image.Rect(25, 0, 50, 20)),
&widgetapi.Meta{Focused: true},
widgetapi.Options{WantKeyboard: widgetapi.KeyScopeFocused},
&terminalapi.Keyboard{},
)
return ft
},

View File

@ -114,9 +114,8 @@ func (ft *focusTracker) next() {
if nextCont == nil && firstCont != nil {
// If the traversal finishes without finding the next container, move
// focus back to the first container.
nextCont = firstCont
}
if nextCont != nil {
ft.setActive(firstCont)
} else if nextCont != nil {
ft.setActive(nextCont)
}
}