vty-windows 0.2.0.0 → 0.2.0.1
raw patch · 4 files changed
+28/−9 lines, 4 files
Files
- CHANGELOG.md +5/−0
- src/Graphics/Vty/Platform/Windows.hs +21/−7
- src/Graphics/Vty/Platform/Windows/WindowsCapabilities.hs +1/−1
- vty-windows.cabal +1/−1
CHANGELOG.md view
@@ -25,3 +25,8 @@ ------- * The color mode configuration moved from Windows specific settings to the vty user config. + +0.2.0.1 +------- +* On shutdown, make sure to shut down output interface before shutting down input interface. + Fixes mouse reset bug.
src/Graphics/Vty/Platform/Windows.hs view
@@ -8,13 +8,14 @@ ) where -import Control.Monad (when) - -import Graphics.Vty (Vty, installCustomWidthTable, mkVtyFromPair) +import Control.Concurrent.STM +import Control.Monad ( when, unless ) -import Graphics.Vty.Config (VtyUserConfig(..)) -import Graphics.Vty.Platform.Windows.Settings - ( defaultSettings, WindowsSettings(settingTermName) ) +import Graphics.Vty ( Vty(..), installCustomWidthTable, mkVtyFromPair ) +import Graphics.Vty.Config ( VtyUserConfig(..) ) +import Graphics.Vty.Input ( Input(shutdownInput) ) +import Graphics.Vty.Output ( Output(releaseTerminal, releaseDisplay) ) +import Graphics.Vty.Platform.Windows.Settings ( defaultSettings, WindowsSettings(settingTermName) ) import Graphics.Vty.Platform.Windows.Input ( buildInput ) import Graphics.Vty.Platform.Windows.Output ( buildOutput ) @@ -39,4 +40,17 @@ input <- buildInput userConfig settings out <- buildOutput userConfig settings - mkVtyFromPair input out+ vty <- mkVtyFromPair input out + + shutdownVar <- newTVarIO False + let shutdownIo = do + alreadyShutdown <- atomically $ swapTVar shutdownVar True + unless alreadyShutdown $ do + releaseDisplay out + releaseTerminal out + shutdownInput input + + shutdownStatus = readTVarIO shutdownVar + + return $ vty { shutdown = shutdownIo + , isShutdown = shutdownStatus }
src/Graphics/Vty/Platform/Windows/WindowsCapabilities.hs view
@@ -42,7 +42,7 @@ , ("clear", csi "H" ++ csi "J") -- move cursor to home row, then clear from cursor to end of screen (whole screen) , ("cup", csi "%i%p1%d;%p2%dH") , ("civis", csi "?25l") - , ("cnorm", csi "34h" ++ csi "?25h") + , ("cnorm", csi "?25h") , ("home", csi "H") , ("ed", csi "J") , ("el", csi "K")
vty-windows.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: vty-windows -version: 0.2.0.0 +version: 0.2.0.1 license: BSD-3-Clause license-file: LICENSE author: Chris hackett