on master help sign in
Config: add allowCustomUnicodeWithTables to control whether a custom table load is ever attempted
9737f2bJonathan Daugherty
src/Graphics/Vty.hs+4−1
@@ -113,7 +113,10 @@ data Vty = Vty
113mkVty :: Config -> IO Vty
113mkVty :: Config -> IO Vty
114mkVty appConfig = do
114mkVty appConfig = do
115 config <- (<> appConfig) <$> userConfig
115 config <- (<> appConfig) <$> userConfig
116+
117+ when (allowCustomUnicodeWithTables config) $
116− installWidthTable config
118+ installWidthTable config
119+
117 input <- inputForConfig config
120 input <- inputForConfig config
118 out <- outputForConfig config
121 out <- outputForConfig config
119 intMkVty input out
122 intMkVty input out
src/Graphics/Vty/Config.hs+4
@@ -148,6 +148,8 @@ data Config = Config
148 , termName :: Maybe String
148 , termName :: Maybe String
149 -- | Terminal width map files.
149 -- | Terminal width map files.
150 , termWidthMaps :: [(String, FilePath)]
150 , termWidthMaps :: [(String, FilePath)]
151+ -- | Whether to permit custom Unicode width table loading.
152+ , allowCustomUnicodeWithTables :: Bool
151 } deriving (Show, Eq)
153 } deriving (Show, Eq)
152
154
153defaultConfig :: Config
155defaultConfig :: Config
@@ -166,6 +168,7 @@ instance Semigroup Config where
166 , outputFd = outputFd c1 <|> outputFd c0
168 , outputFd = outputFd c1 <|> outputFd c0
167 , termName = termName c1 <|> termName c0
169 , termName = termName c1 <|> termName c0
168 , termWidthMaps = termWidthMaps c1 <|> termWidthMaps c0
170 , termWidthMaps = termWidthMaps c1 <|> termWidthMaps c0
171+ , allowCustomUnicodeWithTables = allowCustomUnicodeWithTables c1
169 }
172 }
170
173
171instance Monoid Config where
174instance Monoid Config where
@@ -180,6 +183,7 @@ instance Monoid Config where
180 , outputFd = Nothing
183 , outputFd = Nothing
181 , termName = Nothing
184 , termName = Nothing
182 , termWidthMaps = []
185 , termWidthMaps = []
186+ , allowCustomUnicodeWithTables = True
183 }
187 }
184#if !(MIN_VERSION_base(4,11,0))
188#if !(MIN_VERSION_base(4,11,0))
185 mappend = (<>)
189 mappend = (<>)