func listActions()

in pkg/display/graph/tree/list.go [171:203]


func listActions(key string, list *widgets.List, tree *widgets.Tree, listActive bool) func() {
	var f func()
	switch key {
	case "k", "<Up>":
		if listActive {
			f = list.ScrollUp
			tree.SelectedRow = 0
		} else {
			f = tree.ScrollUp
		}
	case "j", "<Down>":
		if listActive {
			tree.SelectedRow = 0
			f = list.ScrollDown
		} else {
			f = tree.ScrollDown
		}
	case "<Home>":
		if listActive {
			f = list.ScrollTop
		} else {
			f = tree.ScrollTop
		}
	case "<End>":
		if listActive {
			f = list.ScrollBottom
		} else {
			f = tree.ScrollBottom
		}
	}

	return f
}