TabularListDemo: update cursor location text

This commit is contained in:
Jonathan Daugherty 2022-12-27 15:56:11 -08:00
parent 16666f3891
commit f4561dc662

View File

@ -23,8 +23,7 @@ import Brick.Types
( Widget ( Widget
) )
import Brick.Widgets.Core import Brick.Widgets.Core
( (<+>) ( (<=>)
, (<=>)
, str , str
, vLimit , vLimit
, hLimit , hLimit
@ -47,11 +46,10 @@ drawUI :: AppState -> [Widget ()]
drawUI s = [ui] drawUI s = [ui]
where where
l = s^.tabularList l = s^.tabularList
label = str "Item " <+> cur <+> str " of " <+> total label = str $ "Row " <> cur <> " / col " <> show (s^.colIndex + 1)
cur = case l^.(L.listSelectedL) of cur = case l^.(L.listSelectedL) of
Nothing -> str "-" Nothing -> "-"
Just i -> str (show (i + 1)) Just i -> show (i + 1)
total = str $ show $ Vec.length $ l^.(L.listElementsL)
box = B.borderWithLabel label $ box = B.borderWithLabel label $
hLimit totalWidth $ hLimit totalWidth $
vLimit 15 $ vLimit 15 $