@@ -27,7 +27,7 @@ import Syntax
2727import Config
2828import Width (displayWidth , toMaxWidth , toWidth )
2929import UI.HSCurses.Curses qualified as Curses
30- import Keyboard (unkey , charToKey )
30+ import Keyboard (unkey , charToKey , historyKeys )
3131
3232import Data.Array ((!) , bounds , Array )
3333import Data.Array.Base (unsafeAt )
@@ -235,13 +235,15 @@ helpModal help swd = (wd, map showLine help) where
235235------------------------------------------------------------------------
236236
237237histModal :: HistDisplay -> ModalMaker
238+ histModal [] _ = let s = " No history " in (P. length s, [s])
238239histModal hist swd = do
239240 let wd = commonModalWidth swd
240- mtlen = maximum $ 0 : map (displayWidth . fst ) hist
241+ mtlen = maximum $ map (displayWidth . fst ) hist
241242 tlen = min (mtlen + 1 ) $ wd `div` 3
242- (wd,) $ flip map ( zip ([ ' 0 ' .. ' 9 ' ] ++ [ ' a ' .. ' z ' ]) hist) \ (c, (time, (_, song))) ->
243+ (wd, [
243244 let tstr = toMaxWidth tlen $ P. replicate (tlen - displayWidth time) ' ' <> time
244245 in mconcat [" " , P. singleton c, " " , tstr, " " , song]
246+ | (c, (time, (_, song))) <- zip (toList historyKeys ++ repeat ' ' ) hist ])
245247
246248------------------------------------------------------------------------
247249
@@ -484,9 +486,7 @@ renderModals st sz =
484486 ExitModal -> exitModal
485487
486488------------------------------------------------------------------------
487- --
488489-- | Draw the screen
489- --
490490redraw :: Draw
491491redraw = Draw $ discardErrors {- TODO what errors are discarded? -} do
492492 st <- getsHS id -- another refresh could be triggered?
@@ -516,9 +516,7 @@ redraw = Draw $ discardErrors {- TODO what errors are discarded? -} do
516516 -- todo rendering bug here when deleting backwards in minibuffer
517517
518518------------------------------------------------------------------------
519- --
520519-- | Draw a coloured (or not) string to the screen
521- --
522520drawLine :: StringA -> IO ()
523521drawLine (Fast ps sty) = drawSegment ps sty
524522drawLine (FancyS ls) = traverse_ (uncurry drawSegment) ls
0 commit comments