on master help sign in
Fixup how the standardIOConfig is applied. Correct the Config Monoid. #77
commit954e0f14ecfdfae0aee2ee6f3665b73107120ac3 authorCorey O'Connor <coreyoconnor@gmail.com> dateSun 9 Aug 2015, 13:55 (11 years ago) parent07b7a89
7 files changed+15−9
CHANGELOG+3 Demo.hs+1−1 src/Graphics/Vty/Config.hs+4−4 src/Graphics/Vty/Inline/Unsafe.hs+1−1 src/Graphics/Vty/Input.hs+3−1 src/Graphics/Vty/Input/Loop.hs−1 src/Graphics/Vty/Output.hs+3−1
CHANGELOG+3
@@ -1,4 +1,7 @@
115.2.12
2+ - The standard IO Config (standardIOConfig) was overriding any provided application config.
3+ In addition, the inputFd and outputFd could not be changed if mkVty was used.
4+ Fixed.
25 - Correct handling of display attributes at end of line. The output attributes are set to default
36 at the end of content for the line and at the start of a new line. Previously the current
47 attribute would extend to the next start of content. This was odd to reason about and was the
Demo.hs+1−1
@@ -20,7 +20,7 @@ type App = RWST Vty () (Seq String) IO
2020main = do
2121 vty <- if True -- change to false for emacs-like input processing
2222 then mkVty def
23− else mkVty (def { vmin = Just 2, vtime = Just 100 } )
23+ else mkVty (def { vmin = Just 2, vtime = Just 300 } )
2424 _ <- execRWST (vtyInteract False) vty Seq.empty
2525 shutdown vty
2626
src/Graphics/Vty/Config.hs+4−4
@@ -139,8 +139,8 @@ instance Monoid Config where
139139 , vtime = vtime c1 <|> vtime c0
140140 , debugLog = debugLog c1 <|> debugLog c0
141141 , inputMap = inputMap c0 <> inputMap c1
142− , inputFd = inputFd c1 <|> inputFd c1
143− , outputFd = outputFd c1 <|> outputFd c1
142+ , inputFd = inputFd c1 <|> inputFd c0
143+ , outputFd = outputFd c1 <|> outputFd c0
144144 , termName = termName c1 <|> termName c0
145145 }
146146
@@ -151,8 +151,8 @@ userConfig :: IO Config
151151userConfig = do
152152 configFile <- (mappend <$> getAppUserDataDirectory "vty" <*> pure "/config") >>= parseConfigFile
153153 overrideConfig <- maybe (return def) parseConfigFile =<< getEnv "VTY_CONFIG_FILE"
154− base <- (<> configFile <> overrideConfig) <$> standardIOConfig
155− (mappend base) <$> overrideEnvConfig
154+ let base = configFile <> overrideConfig
155+ mappend base <$> overrideEnvConfig
156156
157157overrideEnvConfig :: IO Config
158158overrideEnvConfig = do
src/Graphics/Vty/Inline/Unsafe.hs+1−1
@@ -61,7 +61,7 @@ withOutput f = do
6161 mout <- readIORef globalOutput
6262 out <- case mout of
6363 Nothing -> do
64− config <- (<>) <$> userConfig <*> mkDupeConfig
64+ config <- mappend <$> userConfig <*> mkDupeConfig
6565 out <- outputForConfig config
6666 writeIORef globalOutput (Just out)
6767 return out
src/Graphics/Vty/Input.hs+3−1
@@ -145,6 +145,8 @@ import System.Posix.Signals.Exts
145145#if !(MIN_VERSION_base(4,8,0))
146146import Data.Functor ((<$>))
147147import Data.Monoid
148+#else
149+import Data.Monoid ((<>))
148150#endif
149151
150152-- | Set up the terminal with file descriptor `inputFd` for input. Returns a 'Input'.
@@ -201,4 +203,4 @@ inputForConfig config@Config{ termName = Just termName
201203 _ <- installHandler continueProcess Ignore Nothing
202204 unsetAttrs
203205 }
204−inputForConfig config = mappend config <$> standardIOConfig >>= inputForConfig
206+inputForConfig config = (<> config) <$> standardIOConfig >>= inputForConfig
src/Graphics/Vty/Input/Loop.hs−1
@@ -19,7 +19,6 @@ import Graphics.Vty.Input.Events
1919
2020import Control.Applicative
2121import Control.Concurrent
22−import Control.Concurrent.MVar
2322import Control.Exception (mask, try, SomeException)
2423import Control.Lens
2524import Control.Monad (when, mzero, forM_)
src/Graphics/Vty/Output.hs+3−1
@@ -50,6 +50,8 @@ import Data.List (isPrefixOf)
5050
5151#if !(MIN_VERSION_base(4,8,0))
5252import Data.Monoid (mappend)
53+#else
54+import Data.Monoid ((<>))
5355#endif
5456
5557-- | Returns a `Output` for the terminal specified in `Config`
@@ -76,7 +78,7 @@ outputForConfig Config{ outputFd = Just fd, termName = Just termName, .. } = do
7678 -- Not an xterm-like terminal. try for generic terminfo.
7779 else TerminfoBased.reserveTerminal termName fd
7880 return t
79−outputForConfig config = mappend config <$> standardIOConfig >>= outputForConfig
81+outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig
8082
8183-- | Sets the cursor position to the given output column and row.
8284--