ghcup-0.1.50.1: ghc toolchain installer
Safe HaskellSafe-Inferred
LanguageHaskell2010

GHCup.Brick.Widgets.SectionList

Synopsis

Documentation

data GenericSectionList n t e Source #

Constructors

GenericSectionList 

Fields

sectionListNameL :: forall n t e. Lens' (GenericSectionList n t e) n Source #

sectionListElementsL :: forall n t e t e. Lens (GenericSectionList n t e) (GenericSectionList n t e) (Vector (GenericList n t e)) (Vector (GenericList n t e)) Source #

type SectionList n e = GenericSectionList n Vector e Source #

class ListItemSectionNameIndex n where Source #

To support selection by mouse click we need to obtain section name and item index from the name of the item that got clicked. This helper class is to get that

Instances

Instances details
ListItemSectionNameIndex Name Source # 
Instance details

Defined in GHCup.Brick.Widgets.Navigation

sectionList :: Foldable t => n -> [(n, t e)] -> Int -> GenericSectionList n t e Source #

Build a SectionList from nonempty list. If empty we could not defined sectionL lenses.

sectionL :: Eq n => n -> Lens' (GenericSectionList n t e) (GenericList n t e) Source #

This lens constructor, takes a name and looks if a section has such a name. Used to dispatch events to sections. It is a partial function only meant to be used with the FocusRing inside GenericSectionList

handleGenericListEvent :: (Foldable t, Splittable t, Ord n, ListItemSectionNameIndex n) => BrickEvent n a -> EventM n (GenericSectionList n t e) () Source #

Handle events for list cursor movement. Events handled are:

  • Up (up arrow key). If first element of section, then jump prev section
  • Down (down arrow key). If last element of section, then jump next section
  • Page Up (PgUp)
  • Page Down (PgDown)
  • Go to next section (Tab)
  • Go to prev section (BackTab)
  • Select an element via Mouse left click

renderSectionList Source #

Arguments

:: forall n t e. (Traversable t, Ord n, Show n, Eq n, Splittable t, Semigroup (t e)) 
=> (Int -> Bool -> e -> Widget n)

Rendering function of the list element, True for the selected element

-> Bool

Whether the section list has focus

-> GenericSectionList n t e

The section list to render

-> Widget n 

sectionListSelectedElement :: (Eq n, Splittable t, Traversable t, Semigroup (t e)) => GenericSectionList n t e -> Maybe (Int, e) Source #

Equivalent to listSelectedElement