mirror of
https://github.com/jtdaugherty/brick.git
synced 2024-11-26 09:06:56 +03:00
renderFinal: reset render-specific state in between renderings to avoid preservation of stale state (extents, etc) across renderings
This commit is contained in:
parent
aeeee31e49
commit
696ae5c467
@ -8,7 +8,7 @@ module Brick.Widgets.Internal
|
||||
)
|
||||
where
|
||||
|
||||
import Lens.Micro ((^.), (&), (%~))
|
||||
import Lens.Micro ((^.), (&), (%~), (.~))
|
||||
import Lens.Micro.Mtl ((%=))
|
||||
import Control.Monad
|
||||
import Control.Monad.State.Strict
|
||||
@ -35,7 +35,14 @@ renderFinal :: (Ord n)
|
||||
renderFinal aMap layerRenders (w, h) chooseCursor rs =
|
||||
(newRS, picWithBg, theCursor, concat layerExtents)
|
||||
where
|
||||
(layerResults, !newRS) = flip runState rs $ sequence $
|
||||
-- Reset various fields from the last rendering state so they
|
||||
-- don't accumulate or affect this rendering.
|
||||
resetRs = rs & reportedExtentsL .~ mempty
|
||||
& observedNamesL .~ mempty
|
||||
& clickableNamesL .~ mempty
|
||||
& requestedVisibleNames_L .~ mempty
|
||||
|
||||
(layerResults, !newRS) = flip runState resetRs $ sequence $
|
||||
(\p -> runReaderT p ctx) <$>
|
||||
(\layerWidget -> do
|
||||
result <- render $ cropToContext layerWidget
|
||||
|
Loading…
Reference in New Issue
Block a user