ghc-debug-brick-0.8.0.0: src/GHC/Debug/Brick/Render/HistoryPicker.hs
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE GADTs #-}
module GHC.Debug.Brick.Render.HistoryPicker (
commandWidget,
commandDescription,
) where
import GHC.Debug.Brick.Model (SearchCmd(..), HistoryCommand(..), SomeSearchCmd(..), ProfileLevel (..))
import GHC.Debug.Brick.Namespace
import Brick.Types
import Brick.Widgets.Core
import qualified Data.Text as Text
import Data.Text (Text)
import GHC.Debug.Brick.Render.Filter (renderShortUIDescription)
commandWidget :: Int -> HistoryCommand -> Widget Name
commandWidget _size =
txt . commandDescription
commandDescription :: HistoryCommand -> Text
commandDescription (HistoryCommand (SomeSearchCmd cmd)) =
case cmd of
DoGcRootsSearch ->
"Gc Roots"
DoRetainerSearch _limit uifilters ->
"Retainer" <> case uifilters of
[] -> ""
_ -> " " <> Text.intercalate "," (map renderShortUIDescription uifilters)
DoProfileSearch lvl ->
"Profile" <> case lvl of
OneLevel -> ""
TwoLevel -> " (2 level)"
DoStringSearch ->
"Strings"
DoArrWordsSearch ->
"ArrWords"
DoThunkSearch ->
"Thunks"