on master help sign in
Bugfix: make "refresh" actually behave as advertised (fixes #104)

This change fixes "refresh" by clearing the AssumedState of the DisplayContext used to do the refresh operation. Before this change, "refresh" would trigger a redraw but the redraw would check the new output picture against the previous one and determine that there were no differences, resulting in a no-op redraw. This change fixes that behavior by first clearing the previous draw state of the DisplayContext to force the output routine to conclude that the new picture is different on every line.

commit89e537b2a1833860d0ac013e0a37a083185610fe authorJonathan Daugherty <cygnus@foobox.com> dateSun 28 Aug 2016, 09:46 (10 years ago) parent58f4e9b
1 file changed+7−4
src/Graphics/Vty.hs+7−4
src/Graphics/Vty.hs+7−4
@@ -162,10 +162,13 @@ intMkVty input out = do
162162 writeIORef lastUpdateRef $ Just updateData
163163 writeIORef lastPicRef $ Just inPic'
164164
165− let innerRefresh
166− = writeIORef lastUpdateRef Nothing
167− >> readIORef lastPicRef
168− >>= maybe ( return () ) ( \pic -> innerUpdate pic )
165+ let innerRefresh = do
166+ writeIORef lastUpdateRef Nothing
167+ bounds <- displayBounds out
168+ dc <- displayContext out bounds
169+ writeIORef (assumedStateRef $ contextDevice dc) initialAssumedState
170+ mPic <- readIORef lastPicRef
171+ maybe (return ()) innerUpdate mPic
169172
170173 let gkey = do k <- atomically $ readTChan $ _eventChannel input
171174 case k of