brick-list-skip-0.1.1.12: Skip a certain kind of items when moving in brick list
Safe HaskellSafe-Inferred
LanguageHaskell2010

Brick.Widgets.List.Skip

Description

Functions that brick event handlers can use to move up or down while skipping a certain kind of elements.

For example, in the above demo program, you can move in the list while skipping separators.

Synopsis

Types

data Dir Source #

The direction to move in

Constructors

Bwd

Backward, or Up

Fwd

Forward, or Down

Instances

Instances details
Show Dir Source # 
Instance details

Defined in Brick.Widgets.List.Skip

Methods

showsPrec :: Int -> Dir -> ShowS #

show :: Dir -> String #

showList :: [Dir] -> ShowS #

Eq Dir Source # 
Instance details

Defined in Brick.Widgets.List.Skip

Methods

(==) :: Dir -> Dir -> Bool #

(/=) :: Dir -> Dir -> Bool #

data Amount Source #

The amount to move by

Constructors

One

Move to the next element that fails the test.

Most

Move forward or backward as much as possible, and start searching in the opposite direction.

Page

Move by one page. From there, start searching. If the search fails, start searching in the opposite direction.

HalfPage

Move by half page. From there, start searching. If the search fails, start searching in the opposite direction.

Instances

Instances details
Show Amount Source # 
Instance details

Defined in Brick.Widgets.List.Skip

Eq Amount Source # 
Instance details

Defined in Brick.Widgets.List.Skip

Methods

(==) :: Amount -> Amount -> Bool #

(/=) :: Amount -> Amount -> Bool #

data Move Source #

Description of a movement

Constructors

Move Amount Dir 
NoMove 

Instances

Instances details
Show Move Source # 
Instance details

Defined in Brick.Widgets.List.Skip

Methods

showsPrec :: Int -> Move -> ShowS #

show :: Move -> String #

showList :: [Move] -> ShowS #

Eq Move Source # 
Instance details

Defined in Brick.Widgets.List.Skip

Methods

(==) :: Move -> Move -> Bool #

(/=) :: Move -> Move -> Bool #

Functions

listSkip Source #

Arguments

:: (Foldable t, Splittable t, Searchable t, Ord n) 
=> (e -> Bool)

The test

-> Move 
-> EventM n (GenericList n t e) () 

Move by a specified amount. Skip elements that pass the test.

After moving, this function calls listShow with the direction of Move.

listSearchFromCurrent Source #

Arguments

:: Searchable t 
=> (e -> Bool)

The test

-> Dir 
-> EventM n (GenericList n t e) () 

From the current element, search for an element that fails the test, and go to it.

listShow Source #

Arguments

:: Searchable t 
=> (e -> Bool)

The test

-> Dir 
-> EventM n (GenericList n t e) () 

If searching for an element that fails the test in the specified direction fails, show as many elements as possible in the direction.

The current element is not included in the search.

Classes

class Searchable (t :: * -> *) where Source #

Functions for searching elements.

Methods

viewHead :: t a -> Maybe (a, t a) Source #

Get the head and the rest

viewLast :: t a -> Maybe (t a, a) Source #

Get the last element and the rest

take :: Int -> t a -> t a Source #

Take a number of elements from the beginning

drop :: Int -> t a -> t a Source #

Drop a number of elements from the beginning

Instances

Instances details
Searchable Seq Source #

O(1) for viewHead and viewLast. O(log(min(i,n-i))) for take and drop.

Instance details

Defined in Brick.Widgets.List.Skip

Methods

viewHead :: Seq a -> Maybe (a, Seq a) Source #

viewLast :: Seq a -> Maybe (Seq a, a) Source #

take :: Int -> Seq a -> Seq a Source #

drop :: Int -> Seq a -> Seq a Source #

Searchable Vector Source #

O(1) for all operations

Instance details

Defined in Brick.Widgets.List.Skip

Methods

viewHead :: Vector a -> Maybe (a, Vector a) Source #

viewLast :: Vector a -> Maybe (Vector a, a) Source #

take :: Int -> Vector a -> Vector a Source #

drop :: Int -> Vector a -> Vector a Source #