window.go
func (w *Window) focusPrevious() {
	// it is ok to be negative since that'll focus on the first widget
	w.focus--
	if w.focus < 0 {
		w.focusWidget()
		return
	}

	// find previous widget
	for i := w.focus; i > 0; i-- {
		widget := w.widgets[i]
		if !widget.CanFocus() {
			continue
		}
		setCursor(-1, -1) // hide
		w.focus = i
		widget.Focus()
		return
	}

	// if we get here we need to focus on last focusable widget
	for i := len(w.widgets) - 1; i > w.focus; i-- {
		widget := w.widgets[i]
		if !widget.CanFocus() {
			continue
		}
		setCursor(-1, -1) // hide
		w.focus = i
		widget.Focus()
		return
	}

	// if we get here it means we found nothing usable and give up
}
func (w *Window) focusPrevious() {
	// it is ok to be negative since that'll focus on the first widget
	w.focus--
	if w.focus < 0 {
		w.focusWidget()
		return
	}

	// find previous widget
	for i := w.focus; i > 0; i-- {
		widget := w.widgets[i]
		if !widget.CanFocus() {
			continue
		}
		setCursor(-1, -1) // hide
		w.focus = i
		widget.Focus()
		return
	}

	// if we get here we need to focus on last focusable widget
	for i := len(w.widgets) - 1; i > w.focus; i-- {
		widget := w.widgets[i]
		if !widget.CanFocus() {
			continue
		}
		setCursor(-1, -1) // hide
		w.focus = i
		widget.Focus()
		return
	}

	// if we get here it means we found nothing usable and give up
}
func ( w * Window ) focusPrevious ( ) { // it is ok to be negative since that'll focus on the first widget w . focus -- if w . focus < 0 { w . focusWidget ( ) return } // find previous widget for i := w . focus ; i > 0 ; i -- { widget := w . widgets [ i ] if ! widget . CanFocus ( ) { continue } setCursor ( - 1 , - 1 ) // hide w . focus = i widget . Focus ( ) return } // if we get here we need to focus on last focusable widget for i := len ( w . widgets ) - 1 ; i > w . focus ; i -- { widget := w . widgets [ i ] if ! widget . CanFocus ( ) { continue } setCursor ( - 1 , - 1 ) // hide w . focus = i widget . Focus ( ) return } // if we get here it means we found nothing usable and give up }
// focusPrevious focuses on the previous available widget.
// focusPrevious shall be called from queue context.
focusPrevious focuses on the previous available widget . focusPrevious shall be called from queue context .