From a32d71e551e2b2f422573f25e593e9e58de12f5a Mon Sep 17 00:00:00 2001 From: CrystalSplitter Date: Sun, 11 Feb 2024 01:37:22 -0800 Subject: [PATCH] Add help message on blank start up --- .../Ghcitui/Brick/DrawSourceViewer.hs | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs b/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs index 7fc7012..06634d5 100644 --- a/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs +++ b/lib/ghcitui-brick/Ghcitui/Brick/DrawSourceViewer.hs @@ -31,15 +31,24 @@ drawSourceViewer s currentlyRunning = Daemon.isExecuting (AppState.interpState s) srcWindow = s ^. AppState.sourceWindow notRunningWidget = - padWidget splashWidget - <=> padWidget (B.txt "Nothing executing. Maybe run something?") + withStyle + ( padTop (B.hCenter splashWidget) + <=> padTop + ( B.hCenter (B.txt "Nothing executing. Maybe run something?") + <=> B.hCenter (B.txt "Press '?' for help.") + ) + ) noSourceWidget = - padWidget splashWidget <=> padWidget (B.txt "Can't display. Source not found.") - padWidget w = - B.padTop (B.Pad 3) - . B.hCenter - $ B.withAttr (B.attrName "styled") w - splashWidget = B.txt $ fromMaybe "No splash file loaded." (AppState.splashContents s) + withStyle (B.hCenter splashWidget <=> padTop (B.txt "Can't display. Source not found.")) + splashWidget = + withStyle (B.txt (fromMaybe "No splash file loaded." (AppState.splashContents s))) + + -- Utils + padTop :: B.Widget n -> B.Widget n + padTop = B.padTop (B.Pad 3) + + withStyle :: B.Widget n -> B.Widget n + withStyle = B.withAttr (B.attrName "styled") -- ------------------------------------------------------------------------------------------------- -- Source Viewer Drawing Details