Skip to content

Commit

Permalink
Toggle tests and log panes on t and l (#1197)
Browse files Browse the repository at this point in the history
  • Loading branch information
arcz authored Mar 4, 2024
1 parent fabd1ff commit 09a3c98
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
8 changes: 8 additions & 0 deletions lib/Echidna/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ ui vm world dict initialCorpus = do
, fetchedSlots = mempty
, fetchedDialog = B.dialog (Just $ str " Fetched contracts/slots ") Nothing 80
, displayFetchedDialog = False
, displayLogPane = True
, displayTestsPane = True
, events = mempty
, corpusSize = 0
, coverage = 0
Expand Down Expand Up @@ -290,6 +292,12 @@ monitor = do
VtyEvent (EvKey (KChar 'f') _) ->
modify' $ \state ->
state { displayFetchedDialog = not state.displayFetchedDialog }
VtyEvent (EvKey (KChar 'l') _) ->
modify' $ \state ->
state { displayLogPane = not state.displayLogPane }
VtyEvent (EvKey (KChar 't') _) ->
modify' $ \state ->
state { displayTestsPane = not state.displayTestsPane }
VtyEvent (EvKey KEsc _) -> halt
VtyEvent (EvKey (KChar 'c') l) | MCtrl `elem` l -> halt
MouseDown (SBClick el n) _ _ _ ->
Expand Down
22 changes: 14 additions & 8 deletions lib/Echidna/UI/Widgets.hs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ data UIState = UIState
, fetchedSlots :: Map Addr (Map W256 (Maybe W256))
, fetchedDialog :: B.Dialog () Name
, displayFetchedDialog :: Bool
, displayLogPane :: Bool
, displayTestsPane :: Bool

, events :: Seq (LocalTime, CampaignEvent)
, workersAlive :: Int
Expand Down Expand Up @@ -111,15 +113,19 @@ campaignStatus uiState = do
joinBorders $ borderWithLabel echidnaTitle $
summaryWidget env uiState
<=>
hBorderWithLabel (withAttr (attrName "subtitle") $ str $
(" Tests (" <> show (length uiState.tests)) <> ") ")
(if uiState.displayTestsPane then
hBorderWithLabel (withAttr (attrName "subtitle") $ str $
(" Tests (" <> show (length uiState.tests)) <> ") ")
<=>
inner
else emptyWidget)
<=>
inner
<=>
hBorderWithLabel (withAttr (attrName "subtitle") $ str $
" Log (" <> show (length uiState.events) <> ") ")
<=>
logPane uiState
(if uiState.displayLogPane then
hBorderWithLabel (withAttr (attrName "subtitle") $ str $
" Log (" <> show (length uiState.events) <> ") ")
<=>
logPane uiState
else emptyWidget)
<=>
underneath
echidnaTitle =
Expand Down

0 comments on commit 09a3c98

Please sign in to comment.