diff --git a/CHANGELOG b/CHANGELOG index 2e218b6b..298a22da 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,7 @@ 5.2.12 + - The standard IO Config (standardIOConfig) was overriding any provided application config. + In addition, the inputFd and outputFd could not be changed if mkVty was used. + Fixed. - Correct handling of display attributes at end of line. The output attributes are set to default at the end of content for the line and at the start of a new line. Previously the current attribute would extend to the next start of content. This was odd to reason about and was the diff --git a/Demo.hs b/Demo.hs index 29cf47af..cc133809 100644 --- a/Demo.hs +++ b/Demo.hs @@ -20,7 +20,7 @@ type App = RWST Vty () (Seq String) IO main = do vty <- if True -- change to false for emacs-like input processing then mkVty def - else mkVty (def { vmin = Just 2, vtime = Just 100 } ) + else mkVty (def { vmin = Just 2, vtime = Just 300 } ) _ <- execRWST (vtyInteract False) vty Seq.empty shutdown vty diff --git a/src/Graphics/Vty/Config.hs b/src/Graphics/Vty/Config.hs index 91bb9d91..871c642a 100644 --- a/src/Graphics/Vty/Config.hs +++ b/src/Graphics/Vty/Config.hs @@ -139,8 +139,8 @@ instance Monoid Config where , vtime = vtime c1 <|> vtime c0 , debugLog = debugLog c1 <|> debugLog c0 , inputMap = inputMap c0 <> inputMap c1 - , inputFd = inputFd c1 <|> inputFd c1 - , outputFd = outputFd c1 <|> outputFd c1 + , inputFd = inputFd c1 <|> inputFd c0 + , outputFd = outputFd c1 <|> outputFd c0 , termName = termName c1 <|> termName c0 } @@ -151,8 +151,8 @@ userConfig :: IO Config userConfig = do configFile <- (mappend <$> getAppUserDataDirectory "vty" <*> pure "/config") >>= parseConfigFile overrideConfig <- maybe (return def) parseConfigFile =<< getEnv "VTY_CONFIG_FILE" - base <- (<> configFile <> overrideConfig) <$> standardIOConfig - (mappend base) <$> overrideEnvConfig + let base = configFile <> overrideConfig + mappend base <$> overrideEnvConfig overrideEnvConfig :: IO Config overrideEnvConfig = do diff --git a/src/Graphics/Vty/Inline/Unsafe.hs b/src/Graphics/Vty/Inline/Unsafe.hs index 5a34b5e2..48811896 100644 --- a/src/Graphics/Vty/Inline/Unsafe.hs +++ b/src/Graphics/Vty/Inline/Unsafe.hs @@ -61,7 +61,7 @@ withOutput f = do mout <- readIORef globalOutput out <- case mout of Nothing -> do - config <- (<>) <$> userConfig <*> mkDupeConfig + config <- mappend <$> userConfig <*> mkDupeConfig out <- outputForConfig config writeIORef globalOutput (Just out) return out diff --git a/src/Graphics/Vty/Input.hs b/src/Graphics/Vty/Input.hs index 258a8c59..9177ded4 100644 --- a/src/Graphics/Vty/Input.hs +++ b/src/Graphics/Vty/Input.hs @@ -145,6 +145,8 @@ import System.Posix.Signals.Exts #if !(MIN_VERSION_base(4,8,0)) import Data.Functor ((<$>)) import Data.Monoid +#else +import Data.Monoid ((<>)) #endif -- | Set up the terminal with file descriptor `inputFd` for input. Returns a 'Input'. @@ -201,4 +203,4 @@ inputForConfig config@Config{ termName = Just termName _ <- installHandler continueProcess Ignore Nothing unsetAttrs } -inputForConfig config = mappend config <$> standardIOConfig >>= inputForConfig +inputForConfig config = (<> config) <$> standardIOConfig >>= inputForConfig diff --git a/src/Graphics/Vty/Input/Loop.hs b/src/Graphics/Vty/Input/Loop.hs index 8bbe8002..df20782b 100644 --- a/src/Graphics/Vty/Input/Loop.hs +++ b/src/Graphics/Vty/Input/Loop.hs @@ -19,7 +19,6 @@ import Graphics.Vty.Input.Events import Control.Applicative import Control.Concurrent -import Control.Concurrent.MVar import Control.Exception (mask, try, SomeException) import Control.Lens import Control.Monad (when, mzero, forM_) diff --git a/src/Graphics/Vty/Output.hs b/src/Graphics/Vty/Output.hs index 3b9763b9..a888f2d7 100644 --- a/src/Graphics/Vty/Output.hs +++ b/src/Graphics/Vty/Output.hs @@ -50,6 +50,8 @@ import Data.List (isPrefixOf) #if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (mappend) +#else +import Data.Monoid ((<>)) #endif -- | Returns a `Output` for the terminal specified in `Config` @@ -76,7 +78,7 @@ outputForConfig Config{ outputFd = Just fd, termName = Just termName, .. } = do -- Not an xterm-like terminal. try for generic terminfo. else TerminfoBased.reserveTerminal termName fd return t -outputForConfig config = mappend config <$> standardIOConfig >>= outputForConfig +outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig -- | Sets the cursor position to the given output column and row. --