From 8e1d7f4810b4c54eb75c69c6001425bd9eb4810e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Mon, 24 Aug 2015 13:51:47 +0200 Subject: [PATCH] Internal: force-evaluate the new render state. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Widgets might retain computations which are not actually needed to render the image (e. g., the text widget might contain more lines than can be shown on screen). This seems to leak space as it is left unclear that computations needed to render the current frame will not be needed anymore after the image is shown. --- src/Brick/Widgets/Internal.hs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Brick/Widgets/Internal.hs b/src/Brick/Widgets/Internal.hs index 7742eb5..94e6171 100644 --- a/src/Brick/Widgets/Internal.hs +++ b/src/Brick/Widgets/Internal.hs @@ -1,3 +1,5 @@ +{-# LANGUAGE BangPatterns #-} + module Brick.Widgets.Internal ( renderFinal , cropToContext @@ -24,7 +26,7 @@ renderFinal :: AttrMap -> (RenderState, V.Picture, Maybe CursorLocation) renderFinal aMap layerRenders sz chooseCursor rs = (newRS, pic, theCursor) where - (layerResults, newRS) = flip runState rs $ sequence $ + (layerResults, !newRS) = flip runState rs $ sequence $ (\p -> runReaderT p ctx) <$> (render <$> cropToContext <$> layerRenders) ctx = Context def (fst sz) (snd sz) def aMap