{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE OverloadedLabels #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE TupleSections #-}
-- | Grid tabular list is a uniform grid that supports cell-by-cell navigation.
--
-- ![ ](grid-tabular-list-01.png) ![ ](grid-tabular-list-02.png) ![ ](grid-tabular-list-03.png)
--
-- Read [Shared Traits of Tabular List Widgets]("Brick.Widgets.TabularList#g:SharedTraitsOfTabularListWidgets")
-- before reading further.
--
-- Because this list is designed to show an arbitrary number of columns, horizontal scrolling is supported through
-- cell-by-cell navigation.
--
-- Grid tabular list tries to show the current column in the center. If it can't show the current column in the center,
-- it shows the first column in the left corner or the last column in the right corner.
--
-- It should be fast enough to handle a large spreadsheet. It is also suitable for an interface to a database table.
module Brick.Widgets.TabularList.Grid (
-- * Data types
  GridContents(..)
, GridContext(..)
, GridRenderers(..)
, GridSizes(..)
, GridTabularList(..)
-- * List construction
, gridTabularList
-- * Rendering
, renderGridTabularList
-- * Column navigation
, gridMoveLeft
, gridMoveRight
, gridMoveTo
, gridMoveToBeginning
, gridMoveToEnd
, gridMovePageUp
, gridMovePageDown
-- * Event handlers
, handleGridListEvent
, handleGridListEventVi
-- * Shared types
, module Brick.Widgets.TabularList.Types
) where

import Brick.Widgets.TabularList.Types
import Brick.Widgets.TabularList.Internal.Common
import Brick.Widgets.TabularList.Internal.Lens
-- base
import GHC.Generics (Generic)
import Data.Foldable (toList)
import Control.Monad (unless)
-- Third party libraries
import Optics.Core hiding (Empty)
import qualified Data.Sequence as S
import Data.Sequence (Seq(..))
import Data.Generics.Labels
-- Brick & Vty
import qualified Brick.Widgets.List as L
import Brick.Types
import Brick.Widgets.Core
import Brick.Widgets.Center
import Graphics.Vty (Event(..), Key(..), Modifier(..))
import Brick.Main (lookupViewport)

-- | Functions for getting contents of grid tabular list elements.
-- See [List Type Variables]("Brick.Widgets.TabularList#g:ListTypeVariables").
data GridContents n row cell rowH colH = GridContents {
  forall n row cell rowH colH.
GridContents n row cell rowH colH
-> row -> ColumnIndex -> Maybe cell
cell :: row -> ColumnIndex -> Maybe cell
, forall n row cell rowH colH.
GridContents n row cell rowH colH
-> Maybe (row -> ColumnIndex -> Maybe rowH)
rowHdr :: Maybe (row -> RowIndex -> Maybe rowH)
, forall n row cell rowH colH.
GridContents n row cell rowH colH
-> Maybe (ColumnIndex -> Maybe colH)
colHdr :: Maybe (ColumnIndex -> Maybe colH)
} deriving forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall n row cell rowH colH x.
Rep (GridContents n row cell rowH colH) x
-> GridContents n row cell rowH colH
forall n row cell rowH colH x.
GridContents n row cell rowH colH
-> Rep (GridContents n row cell rowH colH) x
$cto :: forall n row cell rowH colH x.
Rep (GridContents n row cell rowH colH) x
-> GridContents n row cell rowH colH
$cfrom :: forall n row cell rowH colH x.
GridContents n row cell rowH colH
-> Rep (GridContents n row cell rowH colH) x
Generic

-- | Context information for grid cells
data GridContext = GridContext {
  GridContext -> Position
row :: Position -- ^ Position among rows
, GridContext -> Position
col :: Position -- ^ Position among columns
} deriving (ColumnIndex -> GridContext -> ShowS
[GridContext] -> ShowS
GridContext -> String
forall a.
(ColumnIndex -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GridContext] -> ShowS
$cshowList :: [GridContext] -> ShowS
show :: GridContext -> String
$cshow :: GridContext -> String
showsPrec :: ColumnIndex -> GridContext -> ShowS
$cshowsPrec :: ColumnIndex -> GridContext -> ShowS
Show, forall x. Rep GridContext x -> GridContext
forall x. GridContext -> Rep GridContext x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GridContext x -> GridContext
$cfrom :: forall x. GridContext -> Rep GridContext x
Generic)

-- | Rendering functions for elements of grid tabular list. See
--
-- * [List Type Variables]("Brick.Widgets.TabularList#g:ListTypeVariables")
-- * [Rendering]("Brick.Widgets.TabularList#g:Rendering")
data GridRenderers n row cell rowH colH = GridRenderers {
  forall n row cell rowH colH.
GridRenderers n row cell rowH colH
-> ListFocused
-> ColumnIndex
-> GridContext
-> row
-> Maybe cell
-> Widget n
drawCell :: ListFocused -> WidthDeficit -> GridContext -> row -> Maybe cell -> Widget n
, forall n row cell rowH colH.
GridRenderers n row cell rowH colH
-> Maybe
     (ListFocused
      -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
drawRowHdr :: Maybe (ListFocused -> WidthDeficit -> Position -> row -> Maybe rowH -> Widget n)
, forall n row cell rowH colH.
GridRenderers n row cell rowH colH
-> Maybe
     (ListFocused -> ColumnIndex -> Position -> Maybe colH -> Widget n)
drawColHdr :: Maybe (ListFocused -> WidthDeficit -> Position -> Maybe colH -> Widget n)
, forall n row cell rowH colH.
GridRenderers n row cell rowH colH
-> Maybe (ListFocused -> ColumnIndex -> Widget n)
drawColHdrRowHdr :: Maybe (ListFocused -> WidthDeficit -> Widget n)
} deriving forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall n row cell rowH colH x.
Rep (GridRenderers n row cell rowH colH) x
-> GridRenderers n row cell rowH colH
forall n row cell rowH colH x.
GridRenderers n row cell rowH colH
-> Rep (GridRenderers n row cell rowH colH) x
$cto :: forall n row cell rowH colH x.
Rep (GridRenderers n row cell rowH colH) x
-> GridRenderers n row cell rowH colH
$cfrom :: forall n row cell rowH colH x.
GridRenderers n row cell rowH colH
-> Rep (GridRenderers n row cell rowH colH) x
Generic

-- | Sizes for elements of grid tabular list.
-- See [List Type Variables]("Brick.Widgets.TabularList#g:ListTypeVariables").
data GridSizes rowH = GridSizes {
  forall rowH. GridSizes rowH -> Seq ColumnIndex
row :: Seq Width -- ^ Widths for column headers and row columns
, forall rowH. GridSizes rowH -> Maybe (RowHeaderWidth rowH)
rowHdr :: Maybe (RowHeaderWidth rowH) -- ^ Width for row headers
, forall rowH. GridSizes rowH -> Maybe ColumnIndex
colHdr :: Maybe Height -- ^ Height for column headers
} deriving forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall rowH x. Rep (GridSizes rowH) x -> GridSizes rowH
forall rowH x. GridSizes rowH -> Rep (GridSizes rowH) x
$cto :: forall rowH x. Rep (GridSizes rowH) x -> GridSizes rowH
$cfrom :: forall rowH x. GridSizes rowH -> Rep (GridSizes rowH) x
Generic

-- | See [List Type Variables]("Brick.Widgets.TabularList#g:ListTypeVariables").
data GridTabularList n row cell rowH colH = GridTabularList {
  forall n row cell rowH colH.
GridTabularList n row cell rowH colH -> GenericList n Seq row
list :: L.GenericList n Seq row -- ^ The underlying primitive list that comes from brick.
, forall n row cell rowH colH.
GridTabularList n row cell rowH colH -> GridSizes rowH
sizes :: GridSizes rowH
, forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridContents n row cell rowH colH
contents :: GridContents n row cell rowH colH
, forall n row cell rowH colH.
GridTabularList n row cell rowH colH -> ColumnIndex
currentColumn :: ColumnIndex
} deriving forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
forall n row cell rowH colH x.
Rep (GridTabularList n row cell rowH colH) x
-> GridTabularList n row cell rowH colH
forall n row cell rowH colH x.
GridTabularList n row cell rowH colH
-> Rep (GridTabularList n row cell rowH colH) x
$cto :: forall n row cell rowH colH x.
Rep (GridTabularList n row cell rowH colH) x
-> GridTabularList n row cell rowH colH
$cfrom :: forall n row cell rowH colH x.
GridTabularList n row cell rowH colH
-> Rep (GridTabularList n row cell rowH colH) x
Generic

-- | Create a grid tabular list
gridTabularList :: n -- ^ The list name (must be unique)
  -> Seq row -- ^ The initial list rows
  -> ListItemHeight
  -> GridSizes rowH
  -> GridContents n row cell rowH colH
  -> GridTabularList n row cell rowH colH
gridTabularList :: forall n row rowH cell colH.
n
-> Seq row
-> ColumnIndex
-> GridSizes rowH
-> GridContents n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridTabularList n
n Seq row
rows ColumnIndex
h GridSizes rowH
sizes GridContents n row cell rowH colH
contents = GridTabularList {
  $sel:list:GridTabularList :: GenericList n Seq row
list = forall (t :: * -> *) n e.
Foldable t =>
n -> t e -> ColumnIndex -> GenericList n t e
L.list n
n Seq row
rows ColumnIndex
h
, $sel:sizes:GridTabularList :: GridSizes rowH
sizes = GridSizes rowH
sizes
, $sel:contents:GridTabularList :: GridContents n row cell rowH colH
contents = GridContents n row cell rowH colH
contents
, $sel:currentColumn:GridTabularList :: ColumnIndex
currentColumn = ColumnIndex
0
}

data VisibleColumns =
  -- | No column is visible
  NoColumn
  -- | Only current column is visible
  | CurrentColumn
  -- | The first column is shown at the left corner.
  | AnchoredLeft {
      VisibleColumns -> ColumnIndex
right :: Int -- ^ The rightmost column that is visible
  }
  -- | The current column is shown in the center
  | MiddleColumns {
    -- | The leftmost visible column
    VisibleColumns -> ColumnIndex
left :: Int,
    -- | The rightmost visible column
    right :: Int,
    -- | Slide the columns to the left by this offset to show the current column in the center
    VisibleColumns -> ColumnIndex
offset :: Int,
    -- | Total widths of all visible columns.
    VisibleColumns -> ColumnIndex
totalWidth :: Int
  }
  -- | The last column is shown at the right corner.
  | AnchoredRight {
    -- | The leftmost visible column
    left :: Int,
    -- | Slide the columns to the left by this offset to show the last column at the right corner.
    offset :: Int,
    -- | Total widths of all visible columns.
    totalWidth :: Int
  }
  deriving ColumnIndex -> VisibleColumns -> ShowS
[VisibleColumns] -> ShowS
VisibleColumns -> String
forall a.
(ColumnIndex -> a -> ShowS)
-> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VisibleColumns] -> ShowS
$cshowList :: [VisibleColumns] -> ShowS
show :: VisibleColumns -> String
$cshow :: VisibleColumns -> String
showsPrec :: ColumnIndex -> VisibleColumns -> ShowS
$cshowsPrec :: ColumnIndex -> VisibleColumns -> ShowS
Show

-- | Calculate visible columns with the width available for columns. It tries to show the current column in the center.
-- If it can't show the current column in the center, the first column is shown at the left corner, or the last column
-- is shown at the right corner.
visibleColumns :: GridTabularList n row cell rowH colH -> AvailWidth -> VisibleColumns
visibleColumns :: forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> ColumnIndex -> VisibleColumns
visibleColumns GridTabularList n row cell rowH colH
l ColumnIndex
aW = let curCol :: ColumnIndex
curCol = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "currentColumn" a => a
#currentColumn in
  case forall a. ColumnIndex -> Seq a -> (Seq a, Seq a)
S.splitAt ColumnIndex
curCol (GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "row" a => a
#row) of
    -- If current column is outside the boundary of row columns, return `NoColumn`.
    (Seq ColumnIndex
_, Seq ColumnIndex
Empty) -> VisibleColumns
NoColumn
    (Seq ColumnIndex
left, ColumnIndex
cW :<| Seq ColumnIndex
right) -> if ColumnIndex
aW forall a. Ord a => a -> a -> ListFocused
<= ColumnIndex
0
      -- If the available width is 0 or less than 0,
      then VisibleColumns
NoColumn
      -- If the available width is less than the current column's width,
      else if ColumnIndex
cW forall a. Ord a => a -> a -> ListFocused
>= ColumnIndex
aW
      then VisibleColumns
CurrentColumn
      -- Otherwise, calculate the leftmost visible column for the current column shown in the center.
      else let
        -- The amount of space to the left of the current column shown in the center.
        lW :: ColumnIndex
lW = (ColumnIndex
aW forall a. Num a => a -> a -> a
- ColumnIndex
cW) forall a. Integral a => a -> a -> a
`div` ColumnIndex
2
        -- The amount of space to the right of the current column shown in the center.
        rW :: ColumnIndex
rW = ColumnIndex
aW forall a. Num a => a -> a -> a
- ColumnIndex
lW forall a. Num a => a -> a -> a
- ColumnIndex
cW
        -- Calculate the leftmost visible column for the current column shown in the center.
        leftForMiddle :: Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
leftForMiddle (Seq ColumnIndex
l :|> ColumnIndex
w) ColumnIndex
idx ColumnIndex
accW = if ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w forall a. Ord a => a -> a -> ListFocused
< ColumnIndex
lW
          -- If the leftmost visible column hasn't been reached, go to the left by one column.
          then Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
leftForMiddle Seq ColumnIndex
l (ColumnIndex
idxforall a. Num a => a -> a -> a
-ColumnIndex
1) (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w)
          -- If the leftmost visible column has been reached, calculate the rightmost visible column.
          else ColumnIndex
-> ColumnIndex
-> Seq ColumnIndex
-> ColumnIndex
-> ColumnIndex
-> VisibleColumns
rightForMiddle ColumnIndex
idx (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w) Seq ColumnIndex
right (ColumnIndex
curColforall a. Num a => a -> a -> a
+ColumnIndex
1) ColumnIndex
0
        -- If there aren't enough columns to the left of the current column shown in the center, calculate the rightmost
        -- visible column for the first column shown at the left corner.
        leftForMiddle Seq ColumnIndex
Empty ColumnIndex
_ ColumnIndex
accW = Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
rightForLeft Seq ColumnIndex
right (ColumnIndex
curColforall a. Num a => a -> a -> a
+ColumnIndex
1) (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
cW)
        -- Calculate the rightmost visible column for the current column shown in the center.
        rightForMiddle :: ColumnIndex
-> ColumnIndex
-> Seq ColumnIndex
-> ColumnIndex
-> ColumnIndex
-> VisibleColumns
rightForMiddle ColumnIndex
li ColumnIndex
lAccW (ColumnIndex
w :<| Seq ColumnIndex
r) ColumnIndex
ri ColumnIndex
accW = if ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w forall a. Ord a => a -> a -> ListFocused
< ColumnIndex
rW
          -- If the rightmost visible column hasn't been reached, go to the right by one column.
          then ColumnIndex
-> ColumnIndex
-> Seq ColumnIndex
-> ColumnIndex
-> ColumnIndex
-> VisibleColumns
rightForMiddle ColumnIndex
li ColumnIndex
lAccW Seq ColumnIndex
r (ColumnIndex
riforall a. Num a => a -> a -> a
+ColumnIndex
1) (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w)
          -- If the rightmost visible column has been reached, return 'MiddleColumns'.
          else MiddleColumns { $sel:left:NoColumn :: ColumnIndex
left = ColumnIndex
li, $sel:right:NoColumn :: ColumnIndex
right = ColumnIndex
ri, $sel:offset:NoColumn :: ColumnIndex
offset = ColumnIndex
lAccWforall a. Num a => a -> a -> a
-ColumnIndex
lW, $sel:totalWidth:NoColumn :: ColumnIndex
totalWidth = ColumnIndex
lAccWforall a. Num a => a -> a -> a
+ColumnIndex
cWforall a. Num a => a -> a -> a
+ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w }
        -- If there aren't enough columns to the right of the current column shown in the center, calculate the leftmost
        -- visible column for the last column shown at the right corner.
        rightForMiddle ColumnIndex
_ ColumnIndex
_ Seq ColumnIndex
Empty ColumnIndex
_ ColumnIndex
accW = Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
leftForRight Seq ColumnIndex
left (ColumnIndex
curColforall a. Num a => a -> a -> a
-ColumnIndex
1) (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
cW)
        -- Calculate the rightmost visible column for the first column shown at the left corner.
        rightForLeft :: Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
rightForLeft (ColumnIndex
w :<| Seq ColumnIndex
r) ColumnIndex
idx ColumnIndex
accW = if ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w forall a. Ord a => a -> a -> ListFocused
< ColumnIndex
aW
          -- If the rightmost visible column hasn't been reached, go to the right by one column.
          then Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
rightForLeft Seq ColumnIndex
r (ColumnIndex
idxforall a. Num a => a -> a -> a
+ColumnIndex
1) (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w)
          -- If the rightmost visible column has been reached, return 'AnchoredLeft'.
          else ColumnIndex -> VisibleColumns
AnchoredLeft ColumnIndex
idx
        -- If there aren't enough columns to fill the available width with the first column at the left corner, return
        -- 'AnchoredLeft' with the last column as the rightmost visible column.
        rightForLeft Seq ColumnIndex
Empty ColumnIndex
idx ColumnIndex
_ = ColumnIndex -> VisibleColumns
AnchoredLeft (ColumnIndex
idxforall a. Num a => a -> a -> a
-ColumnIndex
1)
        -- Calculate the leftmost visible column for the last column shown at the right corner.
        leftForRight :: Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
leftForRight (Seq ColumnIndex
l :|> ColumnIndex
w) ColumnIndex
idx ColumnIndex
accW = if ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w forall a. Ord a => a -> a -> ListFocused
< ColumnIndex
aW
          -- If the leftmost visible column hasn't been reached, go to the left by one column.
          then Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
leftForRight Seq ColumnIndex
l (ColumnIndex
idxforall a. Num a => a -> a -> a
-ColumnIndex
1) (ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w)
          -- If the leftmost visible column has been reached, return 'AnchoredRight'.
          else AnchoredRight { $sel:left:NoColumn :: ColumnIndex
left = ColumnIndex
idx, $sel:offset:NoColumn :: ColumnIndex
offset = ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
wforall a. Num a => a -> a -> a
-ColumnIndex
aW, $sel:totalWidth:NoColumn :: ColumnIndex
totalWidth = ColumnIndex
accWforall a. Num a => a -> a -> a
+ColumnIndex
w }
        -- If there aren't enough columns to fill the available width with the last column at the right corner, return
        -- 'AnchoredLeft' with the last column as the rightmost visible column.
        leftForRight Seq ColumnIndex
Empty ColumnIndex
_ ColumnIndex
_ = ColumnIndex -> VisibleColumns
AnchoredLeft forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t a -> ColumnIndex
length (GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "row" a => a
#row) forall a. Num a => a -> a -> a
- ColumnIndex
1
        in Seq ColumnIndex -> ColumnIndex -> ColumnIndex -> VisibleColumns
leftForMiddle Seq ColumnIndex
left (ColumnIndex
curColforall a. Num a => a -> a -> a
-ColumnIndex
1) ColumnIndex
0

renderColumns :: GridTabularList n row cell rowH colH
  -> VisibleColumns
  -> (WidthDeficit -> ColumnIndex -> Width -> Widget n)
  -> Widget n
renderColumns :: forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> VisibleColumns
-> (ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n)
-> Widget n
renderColumns GridTabularList n row cell rowH colH
l VisibleColumns
vCs ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
dC = forall n. Size -> Size -> RenderM n (Result n) -> Widget n
Widget Size
Greedy Size
Fixed forall a b. (a -> b) -> a -> b
$ do
  Context n
c <- forall n. RenderM n (Context n)
getContext
  let cWs :: Seq ColumnIndex
cWs = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "row" a => a
#row
      iH :: ColumnIndex
iH = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listItemHeight" a => a
#listItemHeight
      curCol :: ColumnIndex
curCol = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "currentColumn" a => a
#currentColumn
      aW :: ColumnIndex
aW = Context n
cforall {s} {a}. s -> Getting a s a -> a
^^.forall n. Lens' (Context n) ColumnIndex
availWidthL
  forall n. Widget n -> RenderM n (Result n)
render forall a b. (a -> b) -> a -> b
$ case VisibleColumns
vCs of
    VisibleColumns
NoColumn -> forall n. Widget n
emptyWidget
    VisibleColumns
CurrentColumn -> case forall a. ColumnIndex -> Seq a -> Maybe a
S.lookup ColumnIndex
curCol Seq ColumnIndex
cWs of
      Maybe ColumnIndex
Nothing -> forall a. HasCallStack => String -> a
error forall a b. (a -> b) -> a -> b
$ String
"Current column, " forall a. Semigroup a => a -> a -> a
<> forall a. Show a => a -> String
show ColumnIndex
curCol forall a. Semigroup a => a -> a -> a
<> String
" is outside the boundary of column widths."
      Just ColumnIndex
cW -> ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
dC (forall a. Ord a => a -> a -> a
max ColumnIndex
0 forall a b. (a -> b) -> a -> b
$ ColumnIndex
cW forall a. Num a => a -> a -> a
- ColumnIndex
aW) ColumnIndex
curCol ColumnIndex
aW
    AnchoredLeft ColumnIndex
right -> forall n. [Widget n] -> Widget n
hBox forall a b. (a -> b) -> a -> b
$ forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
dC ColumnIndex
0) [ColumnIndex
0..] forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall a. ColumnIndex -> Seq a -> Seq a
S.take (ColumnIndex
rightforall a. Num a => a -> a -> a
+ColumnIndex
1) Seq ColumnIndex
cWs
    MiddleColumns {ColumnIndex
totalWidth :: ColumnIndex
offset :: ColumnIndex
right :: ColumnIndex
left :: ColumnIndex
$sel:totalWidth:NoColumn :: VisibleColumns -> ColumnIndex
$sel:offset:NoColumn :: VisibleColumns -> ColumnIndex
$sel:left:NoColumn :: VisibleColumns -> ColumnIndex
$sel:right:NoColumn :: VisibleColumns -> ColumnIndex
..} -> forall n. ColumnIndex -> Widget n -> Widget n
cropLeftBy ColumnIndex
offset forall a b. (a -> b) -> a -> b
$ forall n. (ColumnIndex, ColumnIndex) -> Widget n -> Widget n
setAvailableSize (ColumnIndex
totalWidth, ColumnIndex
iH) forall a b. (a -> b) -> a -> b
$
      forall n. [Widget n] -> Widget n
hBox forall a b. (a -> b) -> a -> b
$ forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
dC ColumnIndex
0) [ColumnIndex
left..] forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall a. ColumnIndex -> Seq a -> Seq a
S.take (ColumnIndex
rightforall a. Num a => a -> a -> a
-ColumnIndex
leftforall a. Num a => a -> a -> a
+ColumnIndex
1) forall a b. (a -> b) -> a -> b
$ forall a. ColumnIndex -> Seq a -> Seq a
S.drop ColumnIndex
left Seq ColumnIndex
cWs
    AnchoredRight {ColumnIndex
totalWidth :: ColumnIndex
offset :: ColumnIndex
left :: ColumnIndex
$sel:totalWidth:NoColumn :: VisibleColumns -> ColumnIndex
$sel:offset:NoColumn :: VisibleColumns -> ColumnIndex
$sel:left:NoColumn :: VisibleColumns -> ColumnIndex
..} -> forall n. ColumnIndex -> Widget n -> Widget n
cropLeftBy ColumnIndex
offset forall a b. (a -> b) -> a -> b
$ forall n. (ColumnIndex, ColumnIndex) -> Widget n -> Widget n
setAvailableSize (ColumnIndex
totalWidth, ColumnIndex
iH) forall a b. (a -> b) -> a -> b
$
      forall n. [Widget n] -> Widget n
hBox forall a b. (a -> b) -> a -> b
$ forall a b c. (a -> b -> c) -> [a] -> [b] -> [c]
zipWith (ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
dC ColumnIndex
0) [ColumnIndex
left..] forall a b. (a -> b) -> a -> b
$ forall (t :: * -> *) a. Foldable t => t a -> [a]
toList forall a b. (a -> b) -> a -> b
$ forall a. ColumnIndex -> Seq a -> Seq a
S.drop ColumnIndex
left Seq ColumnIndex
cWs

-- | Render grid tabular list
renderGridTabularList :: (Ord n, Show n)
  => GridRenderers n row cell rowH colH -- ^ Renderers
  -> ListFocused
  -> GridTabularList n row cell rowH colH -- ^ The list
  -> Widget n
renderGridTabularList :: forall n row cell rowH colH.
(Ord n, Show n) =>
GridRenderers n row cell rowH colH
-> ListFocused -> GridTabularList n row cell rowH colH -> Widget n
renderGridTabularList GridRenderers n row cell rowH colH
r ListFocused
lf GridTabularList n row cell rowH colH
l = forall n. Size -> Size -> RenderM n (Result n) -> Widget n
Widget Size
Greedy Size
Greedy forall a b. (a -> b) -> a -> b
$ do
  Context n
c <- forall n. RenderM n (Context n)
getContext
  let drawCell :: ListFocused
-> ColumnIndex -> GridContext -> row -> Maybe cell -> Widget n
drawCell = GridRenderers n row cell rowH colH
r forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "drawCell" a => a
#drawCell
      cell :: row -> ColumnIndex -> Maybe cell
cell = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "contents" a => a
#contents forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "cell" a => a
#cell
      list :: GenericList n Seq row
list = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list
      curCol :: ColumnIndex
curCol = GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "currentColumn" a => a
#currentColumn
      aW :: ColumnIndex
aW = Context n
cforall {s} {a}. s -> Getting a s a -> a
^^.forall n. Lens' (Context n) ColumnIndex
availWidthL
      aH :: ColumnIndex
aH = Context n
cforall {s} {a}. s -> Getting a s a -> a
^^.forall n. Lens' (Context n) ColumnIndex
availHeightL
      iH :: ColumnIndex
iH = GenericList n Seq row
list forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "listItemHeight" a => a
#listItemHeight
      wSet :: ColumnIndex -> Widget n -> Widget n
wSet = forall n. (ColumnIndex, ColumnIndex) -> Widget n -> Widget n
setAvailableSize forall b c a. (b -> c) -> (a -> b) -> a -> c
. (, ColumnIndex
iH)
      colHdrRow :: VisibleColumns -> ColumnIndex -> ColumnIndex -> Widget n
colHdrRow VisibleColumns
vCs ColumnIndex
rhw' ColumnIndex
rhwd = case (GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "contents" a => a
#contents forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "colHdr" a => a
#colHdr, GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "colHdr" a => a
#colHdr, GridRenderers n row cell rowH colH
r forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "drawColHdr" a => a
#drawColHdr) of
        (Maybe (ColumnIndex -> Maybe colH)
Nothing, Maybe ColumnIndex
_, Maybe
  (ListFocused -> ColumnIndex -> Position -> Maybe colH -> Widget n)
_) -> forall n. Widget n
emptyWidget
        (Maybe (ColumnIndex -> Maybe colH)
_, Maybe ColumnIndex
Nothing, Maybe
  (ListFocused -> ColumnIndex -> Position -> Maybe colH -> Widget n)
_) -> forall n. Widget n
emptyWidget
        (Maybe (ColumnIndex -> Maybe colH)
_, Maybe ColumnIndex
_, Maybe
  (ListFocused -> ColumnIndex -> Position -> Maybe colH -> Widget n)
Nothing) -> forall n. Widget n
emptyWidget
        (Just ColumnIndex -> Maybe colH
colH, Just ColumnIndex
colHdrH, Just ListFocused -> ColumnIndex -> Position -> Maybe colH -> Widget n
dch) -> let
          drawCol :: ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
drawCol ColumnIndex
wd ColumnIndex
c ColumnIndex
w = forall n. (ColumnIndex, ColumnIndex) -> Widget n -> Widget n
setAvailableSize (ColumnIndex
w, ColumnIndex
colHdrH) forall a b. (a -> b) -> a -> b
$ ListFocused -> ColumnIndex -> Position -> Maybe colH -> Widget n
dch ListFocused
lf ColumnIndex
wd (ColumnIndex -> ListFocused -> Position
Position ColumnIndex
c (ColumnIndex
c forall a. Eq a => a -> a -> ListFocused
== ColumnIndex
curCol)) forall a b. (a -> b) -> a -> b
$ ColumnIndex -> Maybe colH
colH ColumnIndex
c
          chrw :: Widget n
chrw = case GridRenderers n row cell rowH colH
r forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "drawColHdrRowHdr" a => a
#drawColHdrRowHdr of
            Maybe (ListFocused -> ColumnIndex -> Widget n)
Nothing -> forall n. Char -> Widget n
fill Char
' '
            Just ListFocused -> ColumnIndex -> Widget n
dchrw -> ListFocused -> ColumnIndex -> Widget n
dchrw ListFocused
lf ColumnIndex
rhwd
          in forall n. (ColumnIndex, ColumnIndex) -> Widget n -> Widget n
setAvailableSize (ColumnIndex
rhw', ColumnIndex
colHdrH) Widget n
chrw forall n. Widget n -> Widget n -> Widget n
<+> forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> VisibleColumns
-> (ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n)
-> Widget n
renderColumns GridTabularList n row cell rowH colH
l VisibleColumns
vCs ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
drawCol
      renderRow :: VisibleColumns -> ColumnIndex -> ListFocused -> row -> Widget n
renderRow VisibleColumns
vCs ColumnIndex
i ListFocused
f row
r = let
        drawCol :: ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
drawCol ColumnIndex
wd ColumnIndex
c ColumnIndex
w = let gc :: GridContext
gc = Position -> Position -> GridContext
GridContext (ColumnIndex -> ListFocused -> Position
Position ColumnIndex
i ListFocused
f) (ColumnIndex -> ListFocused -> Position
Position ColumnIndex
c forall a b. (a -> b) -> a -> b
$ ColumnIndex
c forall a. Eq a => a -> a -> ListFocused
== ColumnIndex
curCol)
          in forall n. ColumnIndex -> Widget n -> Widget n
wSet ColumnIndex
w forall a b. (a -> b) -> a -> b
$ ListFocused
-> ColumnIndex -> GridContext -> row -> Maybe cell -> Widget n
drawCell ListFocused
lf ColumnIndex
wd GridContext
gc row
r forall a b. (a -> b) -> a -> b
$ row -> ColumnIndex -> Maybe cell
cell row
r ColumnIndex
c
        in forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> VisibleColumns
-> (ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n)
-> Widget n
renderColumns GridTabularList n row cell rowH colH
l VisibleColumns
vCs ColumnIndex -> ColumnIndex -> ColumnIndex -> Widget n
drawCol
      renderList :: RenderM n (Result n)
renderList = let vCs :: VisibleColumns
vCs = forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> ColumnIndex -> VisibleColumns
visibleColumns GridTabularList n row cell rowH colH
l ColumnIndex
aW in
        forall n. Widget n -> RenderM n (Result n)
render forall a b. (a -> b) -> a -> b
$ VisibleColumns -> ColumnIndex -> ColumnIndex -> Widget n
colHdrRow VisibleColumns
vCs ColumnIndex
0 ColumnIndex
0 forall n. Widget n -> Widget n -> Widget n
<=> forall (t :: * -> *) n e.
(Traversable t, Splittable t, Ord n, Show n) =>
(ColumnIndex -> ListFocused -> e -> Widget n)
-> ListFocused -> GenericList n t e -> Widget n
L.renderListWithIndex (VisibleColumns -> ColumnIndex -> ListFocused -> row -> Widget n
renderRow VisibleColumns
vCs) ListFocused
lf GenericList n Seq row
list
      renderHdrList :: (row -> ColumnIndex -> a)
-> ColumnIndex
-> (ListFocused -> ColumnIndex -> Position -> row -> a -> Widget n)
-> RenderM n (Result n)
renderHdrList row -> ColumnIndex -> a
rh ColumnIndex
rhw ListFocused -> ColumnIndex -> Position -> row -> a -> Widget n
drh = let
        rhw' :: ColumnIndex
rhw' = forall a. Ord a => a -> a -> a
min ColumnIndex
rhw ColumnIndex
aW
        rhwd :: ColumnIndex
rhwd = forall a. Ord a => a -> a -> a
max ColumnIndex
0 forall a b. (a -> b) -> a -> b
$ ColumnIndex
rhw forall a. Num a => a -> a -> a
- ColumnIndex
aW
        vCs :: VisibleColumns
vCs = forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> ColumnIndex -> VisibleColumns
visibleColumns GridTabularList n row cell rowH colH
l forall a b. (a -> b) -> a -> b
$ ColumnIndex
aW forall a. Num a => a -> a -> a
- ColumnIndex
rhw'
        renderHdrRow :: ColumnIndex -> ListFocused -> row -> Widget n
renderHdrRow ColumnIndex
i ListFocused
f row
row = forall n. ColumnIndex -> Widget n -> Widget n
wSet ColumnIndex
rhw' (ListFocused -> ColumnIndex -> Position -> row -> a -> Widget n
drh ListFocused
lf ColumnIndex
rhwd (ColumnIndex -> ListFocused -> Position
Position ColumnIndex
i ListFocused
f) row
row forall a b. (a -> b) -> a -> b
$ row -> ColumnIndex -> a
rh row
row ColumnIndex
i) forall n. Widget n -> Widget n -> Widget n
<+> VisibleColumns -> ColumnIndex -> ListFocused -> row -> Widget n
renderRow VisibleColumns
vCs ColumnIndex
i ListFocused
f row
row
        in forall n. Widget n -> RenderM n (Result n)
render forall a b. (a -> b) -> a -> b
$ VisibleColumns -> ColumnIndex -> ColumnIndex -> Widget n
colHdrRow VisibleColumns
vCs ColumnIndex
rhw' ColumnIndex
rhwd forall n. Widget n -> Widget n -> Widget n
<=> forall (t :: * -> *) n e.
(Traversable t, Splittable t, Ord n, Show n) =>
(ColumnIndex -> ListFocused -> e -> Widget n)
-> ListFocused -> GenericList n t e -> Widget n
L.renderListWithIndex ColumnIndex -> ListFocused -> row -> Widget n
renderHdrRow ListFocused
lf GenericList n Seq row
list
  case (GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "contents" a => a
#contents forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "rowHdr" a => a
#rowHdr, GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "rowHdr" a => a
#rowHdr, GridRenderers n row cell rowH colH
r forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "drawRowHdr" a => a
#drawRowHdr) of
    (Maybe (row -> ColumnIndex -> Maybe rowH)
Nothing, Maybe (RowHeaderWidth rowH)
_, Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> RenderM n (Result n)
renderList
    (Maybe (row -> ColumnIndex -> Maybe rowH)
_, Maybe (RowHeaderWidth rowH)
Nothing, Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> RenderM n (Result n)
renderList
    (Maybe (row -> ColumnIndex -> Maybe rowH)
_, Maybe (RowHeaderWidth rowH)
_, Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
Nothing) -> RenderM n (Result n)
renderList
    (Just row -> ColumnIndex -> Maybe rowH
rh, Just (FixedRowHeader ColumnIndex
w), Just ListFocused
-> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n
drh) -> forall {a}.
(row -> ColumnIndex -> a)
-> ColumnIndex
-> (ListFocused -> ColumnIndex -> Position -> row -> a -> Widget n)
-> RenderM n (Result n)
renderHdrList row -> ColumnIndex -> Maybe rowH
rh ColumnIndex
w ListFocused
-> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n
drh
    (Just row -> ColumnIndex -> Maybe rowH
rh, Just (AvailRowHeader ColumnIndex -> ColumnIndex
w), Just ListFocused
-> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n
drh) -> forall {a}.
(row -> ColumnIndex -> a)
-> ColumnIndex
-> (ListFocused -> ColumnIndex -> Position -> row -> a -> Widget n)
-> RenderM n (Result n)
renderHdrList row -> ColumnIndex -> Maybe rowH
rh (ColumnIndex -> ColumnIndex
w ColumnIndex
aW) ListFocused
-> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n
drh
    (Just row -> ColumnIndex -> Maybe rowH
rh, Just (VisibleRowHeaders ColumnIndex -> [rowH] -> ColumnIndex
w), Just ListFocused
-> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n
drh) -> forall {a}.
(row -> ColumnIndex -> a)
-> ColumnIndex
-> (ListFocused -> ColumnIndex -> Position -> row -> a -> Widget n)
-> RenderM n (Result n)
renderHdrList row -> ColumnIndex -> Maybe rowH
rh (ColumnIndex -> [rowH] -> ColumnIndex
w ColumnIndex
aW forall a b. (a -> b) -> a -> b
$ forall n row rowH.
GenericList n Seq row
-> ColumnIndex -> (row -> ColumnIndex -> Maybe rowH) -> [rowH]
visibleRowHdrs GenericList n Seq row
list ColumnIndex
aH row -> ColumnIndex -> Maybe rowH
rh) ListFocused
-> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n
drh

-- | Move to the left by one column.
gridMoveLeft :: GridTabularList n row cell rowH colH -- ^ The list
  -> GridTabularList n row cell rowH colH
gridMoveLeft :: forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveLeft GridTabularList n row cell rowH colH
gl = if forall (t :: * -> *) a. Foldable t => t a -> ListFocused
null forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listSelected" a => a
#listSelected
  then GridTabularList n row cell rowH colH
gl
  else GridTabularList n row cell rowH colH
gl forall a b. a -> (a -> b) -> b
& forall a. IsLabel "currentColumn" a => a
#currentColumn forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> (a -> b) -> s -> t
%~ forall a. Ord a => a -> a -> a
max ColumnIndex
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Num a => a -> a -> a
subtract ColumnIndex
1

-- | Move to the right by one column.
gridMoveRight :: GridTabularList n row cell rowH colH -- ^ The list
  -> GridTabularList n row cell rowH colH
gridMoveRight :: forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveRight GridTabularList n row cell rowH colH
gl = if forall (t :: * -> *) a. Foldable t => t a -> ListFocused
null forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listSelected" a => a
#listSelected
  then GridTabularList n row cell rowH colH
gl
  else GridTabularList n row cell rowH colH
gl forall a b. a -> (a -> b) -> b
& forall a. IsLabel "currentColumn" a => a
#currentColumn forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> (a -> b) -> s -> t
%~ forall a. Ord a => a -> a -> a
min (forall (t :: * -> *) a. Foldable t => t a -> ColumnIndex
length (GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "row" a => a
#row) forall a. Num a => a -> a -> a
- ColumnIndex
1) forall b c a. (b -> c) -> (a -> b) -> a -> c
. (forall a. Num a => a -> a -> a
+ColumnIndex
1)

-- | Move to the given column index
gridMoveTo :: ColumnIndex
  -> GridTabularList n row cell rowH colH -- ^ The list
  -> GridTabularList n row cell rowH colH
gridMoveTo :: forall n row cell rowH colH.
ColumnIndex
-> GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveTo ColumnIndex
n GridTabularList n row cell rowH colH
gl = if forall (t :: * -> *) a. Foldable t => t a -> ListFocused
null forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listSelected" a => a
#listSelected
  then GridTabularList n row cell rowH colH
gl
  else GridTabularList n row cell rowH colH
gl forall a b. a -> (a -> b) -> b
& forall a. IsLabel "currentColumn" a => a
#currentColumn forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ (forall a. Ord a => a -> a -> a
max ColumnIndex
0 forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Ord a => a -> a -> a
min (forall (t :: * -> *) a. Foldable t => t a -> ColumnIndex
length (GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "row" a => a
#row) forall a. Num a => a -> a -> a
- ColumnIndex
1)) ColumnIndex
n

-- | Move to the first column.
gridMoveToBeginning :: GridTabularList n row cell rowH colH -- ^ The list
  -> GridTabularList n row cell rowH colH
gridMoveToBeginning :: forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToBeginning GridTabularList n row cell rowH colH
gl = if forall (t :: * -> *) a. Foldable t => t a -> ListFocused
null forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listSelected" a => a
#listSelected
  then GridTabularList n row cell rowH colH
gl
  else GridTabularList n row cell rowH colH
gl forall a b. a -> (a -> b) -> b
& forall a. IsLabel "currentColumn" a => a
#currentColumn forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ ColumnIndex
0

-- | Move to the last column.
gridMoveToEnd :: GridTabularList n row cell rowH colH -- ^ The list
  -> GridTabularList n row cell rowH colH 
gridMoveToEnd :: forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToEnd GridTabularList n row cell rowH colH
gl = if forall (t :: * -> *) a. Foldable t => t a -> ListFocused
null forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listSelected" a => a
#listSelected
  then GridTabularList n row cell rowH colH
gl
  else GridTabularList n row cell rowH colH
gl forall a b. a -> (a -> b) -> b
& forall a. IsLabel "currentColumn" a => a
#currentColumn forall k (is :: IxList) s t a b.
Is k A_Setter =>
Optic k is s t a b -> b -> s -> t
.~ forall (t :: * -> *) a. Foldable t => t a -> ColumnIndex
length (GridTabularList n row cell rowH colH
gl forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "row" a => a
#row) forall a. Num a => a -> a -> a
- ColumnIndex
1

-- | 'GridRenderers' are needed because if row header renderer doesn't exist, width calculation is affected.
gridMovePage :: Ord n
  => GridRenderers n row cell rowH colH
  -> (VisibleColumns -> EventM n (GridTabularList n row cell rowH colH) ())
  -> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePage :: forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> (VisibleColumns
    -> EventM n (GridTabularList n row cell rowH colH) ())
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePage GridRenderers n row cell rowH colH
r VisibleColumns
-> EventM n (GridTabularList n row cell rowH colH) ()
f = do
  GridTabularList n row cell rowH colH
l <- forall s (m :: * -> *). MonadState s m => m s
get
  forall (f :: * -> *). Applicative f => ListFocused -> f () -> f ()
unless (forall (t :: * -> *) a. Foldable t => t a -> ListFocused
null forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listSelected" a => a
#listSelected) forall a b. (a -> b) -> a -> b
$ do
    Maybe Viewport
v <- forall n s. Ord n => n -> EventM n s (Maybe Viewport)
lookupViewport forall a b. (a -> b) -> a -> b
$ GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "listName" a => a
#listName
    case Maybe Viewport
v of
      Maybe Viewport
Nothing -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
      Just Viewport
vp -> let
        (ColumnIndex
aW, ColumnIndex
aH) = Viewport
vp forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "_vpSize" a => a
#_vpSize
        rhw :: ColumnIndex
rhw = case (GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "contents" a => a
#contents forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "rowHdr" a => a
#rowHdr, GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "sizes" a => a
#sizes forall k l m (is :: IxList) (js :: IxList) (ks :: IxList) s t u v a
       b.
(JoinKinds k l m, AppendIndices is js ks) =>
Optic k is s t u v -> Optic l js u v a b -> Optic m ks s t a b
% forall a. IsLabel "rowHdr" a => a
#rowHdr, GridRenderers n row cell rowH colH
r forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "drawRowHdr" a => a
#drawRowHdr) of
          (Maybe (row -> ColumnIndex -> Maybe rowH)
Nothing, Maybe (RowHeaderWidth rowH)
_, Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> ColumnIndex
0
          (Maybe (row -> ColumnIndex -> Maybe rowH)
_, Maybe (RowHeaderWidth rowH)
Nothing, Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> ColumnIndex
0
          (Maybe (row -> ColumnIndex -> Maybe rowH)
_, Maybe (RowHeaderWidth rowH)
_, Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
Nothing) -> ColumnIndex
0
          (Maybe (row -> ColumnIndex -> Maybe rowH)
_, Just (FixedRowHeader ColumnIndex
w), Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> ColumnIndex
w
          (Maybe (row -> ColumnIndex -> Maybe rowH)
_, Just (AvailRowHeader ColumnIndex -> ColumnIndex
w), Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> ColumnIndex -> ColumnIndex
w ColumnIndex
aW
          (Just row -> ColumnIndex -> Maybe rowH
rowH, Just (VisibleRowHeaders ColumnIndex -> [rowH] -> ColumnIndex
w), Maybe
  (ListFocused
   -> ColumnIndex -> Position -> row -> Maybe rowH -> Widget n)
_) -> ColumnIndex -> [rowH] -> ColumnIndex
w ColumnIndex
aW forall a b. (a -> b) -> a -> b
$ forall n row rowH.
GenericList n Seq row
-> ColumnIndex -> (row -> ColumnIndex -> Maybe rowH) -> [rowH]
visibleRowHdrs (GridTabularList n row cell rowH colH
l forall k s (is :: IxList) a.
Is k A_Getter =>
s -> Optic' k is s a -> a
^. forall a. IsLabel "list" a => a
#list) ColumnIndex
aH row -> ColumnIndex -> Maybe rowH
rowH
        in VisibleColumns
-> EventM n (GridTabularList n row cell rowH colH) ()
f forall a b. (a -> b) -> a -> b
$ forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> ColumnIndex -> VisibleColumns
visibleColumns GridTabularList n row cell rowH colH
l forall a b. (a -> b) -> a -> b
$ ColumnIndex
aW forall a. Num a => a -> a -> a
- ColumnIndex
rhw

-- | Move to the previous page of columns.
--
-- 'GridRenderers' are needed because if row header renderer doesn't exist, width calculation is affected.
gridMovePageUp :: Ord n
  => GridRenderers n row cell rowH colH -- ^ Renderers
  -> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageUp :: forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageUp GridRenderers n row cell rowH colH
r = forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> (VisibleColumns
    -> EventM n (GridTabularList n row cell rowH colH) ())
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePage GridRenderers n row cell rowH colH
r forall a b. (a -> b) -> a -> b
$ \case
  VisibleColumns
NoColumn -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
  VisibleColumns
CurrentColumn -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveLeft
  AnchoredLeft {} -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToBeginning
  MiddleColumns {ColumnIndex
totalWidth :: ColumnIndex
offset :: ColumnIndex
right :: ColumnIndex
left :: ColumnIndex
$sel:totalWidth:NoColumn :: VisibleColumns -> ColumnIndex
$sel:offset:NoColumn :: VisibleColumns -> ColumnIndex
$sel:left:NoColumn :: VisibleColumns -> ColumnIndex
$sel:right:NoColumn :: VisibleColumns -> ColumnIndex
..} -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall a b. (a -> b) -> a -> b
$ forall n row cell rowH colH.
ColumnIndex
-> GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveTo ColumnIndex
left
  AnchoredRight {ColumnIndex
totalWidth :: ColumnIndex
offset :: ColumnIndex
left :: ColumnIndex
$sel:totalWidth:NoColumn :: VisibleColumns -> ColumnIndex
$sel:offset:NoColumn :: VisibleColumns -> ColumnIndex
$sel:left:NoColumn :: VisibleColumns -> ColumnIndex
..} -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall a b. (a -> b) -> a -> b
$ forall n row cell rowH colH.
ColumnIndex
-> GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveTo ColumnIndex
left

-- | Move to the next page of columns.
--
-- 'GridRenderers' are needed because if row header renderer doesn't exist, width calculation is affected.
gridMovePageDown :: Ord n
  => GridRenderers n row cell rowH colH -- ^ Renderers
  -> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageDown :: forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageDown GridRenderers n row cell rowH colH
r = forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> (VisibleColumns
    -> EventM n (GridTabularList n row cell rowH colH) ())
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePage GridRenderers n row cell rowH colH
r forall a b. (a -> b) -> a -> b
$ \case
  VisibleColumns
NoColumn -> forall (m :: * -> *) a. Monad m => a -> m a
return ()
  VisibleColumns
CurrentColumn -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveRight
  AnchoredLeft {ColumnIndex
right :: ColumnIndex
$sel:right:NoColumn :: VisibleColumns -> ColumnIndex
..} -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall a b. (a -> b) -> a -> b
$ forall n row cell rowH colH.
ColumnIndex
-> GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveTo ColumnIndex
right
  MiddleColumns {ColumnIndex
totalWidth :: ColumnIndex
offset :: ColumnIndex
right :: ColumnIndex
left :: ColumnIndex
$sel:totalWidth:NoColumn :: VisibleColumns -> ColumnIndex
$sel:offset:NoColumn :: VisibleColumns -> ColumnIndex
$sel:left:NoColumn :: VisibleColumns -> ColumnIndex
$sel:right:NoColumn :: VisibleColumns -> ColumnIndex
..} -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall a b. (a -> b) -> a -> b
$ forall n row cell rowH colH.
ColumnIndex
-> GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveTo ColumnIndex
right
  AnchoredRight {} -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToEnd

-- | Handle events for grid tabular list with navigation keys.
--
-- It adds the following keyboard shortcuts to 'L.handleListEvent'.
--
-- * Move to the left by one column (Left arrow key)
-- * Move to the right by one column (Right arrow key)
-- * Go to the first column (Ctrl+Home)
-- * Go to the last column (Ctrl+End)
-- * Move to the previous page of columns (Ctrl+PageUp)
-- * Move to the next page of columns (Ctrl+PageDown)
--
-- 'GridRenderers' are needed because if row header renderer doesn't exist, width calculation is affected.
handleGridListEvent :: Ord n
  => GridRenderers n row cell rowH colH -- ^ Renderers
  -> Event -> EventM n (GridTabularList n row cell rowH colH) ()
handleGridListEvent :: forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> Event -> EventM n (GridTabularList n row cell rowH colH) ()
handleGridListEvent GridRenderers n row cell rowH colH
r Event
e = case Event
e of
  EvKey Key
KLeft [] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveLeft
  EvKey Key
KRight [] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveRight
  EvKey Key
KHome [Modifier
MCtrl] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToBeginning
  EvKey Key
KEnd [Modifier
MCtrl] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToEnd
  EvKey Key
KPageUp [Modifier
MCtrl] -> forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageUp GridRenderers n row cell rowH colH
r
  EvKey Key
KPageDown [Modifier
MCtrl] -> forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageDown GridRenderers n row cell rowH colH
r
  Event
_ -> forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom forall a. IsLabel "list" a => a
#list (forall (t :: * -> *) n e.
(Foldable t, Splittable t, Ord n) =>
Event -> EventM n (GenericList n t e) ()
L.handleListEvent Event
e)

-- | Handle events for grid tabular list with vim keys.
--
-- It adds the following keyboard shortcuts to 'L.handleListEventVi'.
--
-- * Move to the left by one column (h)
-- * Move to the right by one column (l)
-- * Go to the first column (H)
-- * Go to the last column (L)
-- * Move to the previous page of columns (Alt+h)
-- * Move to the next page of columns (Alt+l)
--
-- 'GridRenderers' are needed because if row header renderer doesn't exist, width calculation is affected.
handleGridListEventVi :: Ord n
  => GridRenderers n row cell rowH colH -- ^ Renderers
  -> Event -> EventM n (GridTabularList n row cell rowH colH) ()
handleGridListEventVi :: forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> Event -> EventM n (GridTabularList n row cell rowH colH) ()
handleGridListEventVi GridRenderers n row cell rowH colH
r Event
e = case Event
e of
  EvKey (KChar Char
'h') [] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveLeft
  EvKey (KChar Char
'l') [] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveRight
  EvKey (KChar Char
'H') [] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToBeginning
  EvKey (KChar Char
'L') [] -> forall s (m :: * -> *). MonadState s m => (s -> s) -> m ()
modify forall n row cell rowH colH.
GridTabularList n row cell rowH colH
-> GridTabularList n row cell rowH colH
gridMoveToEnd
  EvKey (KChar Char
'h') [Modifier
MMeta] -> forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageUp GridRenderers n row cell rowH colH
r
  EvKey (KChar Char
'l') [Modifier
MMeta] -> forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageDown GridRenderers n row cell rowH colH
r
  EvKey (KChar Char
'h') [Modifier
MAlt] -> forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageUp GridRenderers n row cell rowH colH
r
  EvKey (KChar Char
'l') [Modifier
MAlt] -> forall n row cell rowH colH.
Ord n =>
GridRenderers n row cell rowH colH
-> EventM n (GridTabularList n row cell rowH colH) ()
gridMovePageDown GridRenderers n row cell rowH colH
r
  Event
_ -> forall (m :: * -> *) (n :: * -> *) s t c.
Zoom m n s t =>
LensLike' (Zoomed m c) t s -> m c -> n c
zoom forall a. IsLabel "list" a => a
#list (forall (t :: * -> *) n e.
(Foldable t, Splittable t, Ord n) =>
(Event -> EventM n (GenericList n t e) ())
-> Event -> EventM n (GenericList n t e) ()
L.handleListEventVi (\Event
_ -> forall (m :: * -> *) a. Monad m => a -> m a
return ()) Event
e)