ghc-debug-brick-0.8.0.0: src/GHC/Debug/Brick/Render/Footer.hs
{-# LANGUAGE OverloadedStrings #-}
module GHC.Debug.Brick.Render.Footer where
import Brick
import Brick.Forms
import Data.Text (Text)
import GHC.Debug.Brick.Model
import GHC.Debug.Brick.Render.Utils
footer :: Int -> Maybe Int -> FooterMode -> Widget Name
footer n m fmode = vLimit 1 $
case fmode of
FooterMessage t -> withAttr menuAttr $ hBox [txt t, fill ' ']
FooterInfo -> withAttr menuAttr $ hBox $ [padRight Brick.Max $ txt "(↑↓): select item | (→): expand | (←): collapse | (^p): command picker | (^g): invert filter | (?): full keybindings"]
++ [padLeft (Pad 1) $ str $
(show n <> " items/" <> maybe "∞" show m <> " max")]
FooterInput _im form -> renderForm form
footerInput :: FooterInputMode -> FooterMode
footerInput im =
FooterInput im (footerInputForm im)
footerInputForm :: FooterInputMode -> Form Text e Name
footerInputForm im =
newForm [(\w -> txtLabel (formatFooterMode im) <+> forceAttr inputAttr w) @@= editTextField id Footer (Just 1)] ""