on master help sign in
Config: add allowCustomUnicodeWithTables to control whether a custom table load is ever attempted
commit9737f2b4eee836bebb929454436efe001c4b6e91 authorJonathan Daugherty <cygnus@foobox.com> dateMon 2 Mar 2020, 16:25 (7 years ago) parent9edfd02
2 files changed+8−1
src/Graphics/Vty.hs+4−1 src/Graphics/Vty/Config.hs+4
src/Graphics/Vty.hs+4−1
@@ -113,7 +113,10 @@ data Vty = Vty
113113mkVty :: Config -> IO Vty
114114mkVty appConfig = do
115115 config <- (<> appConfig) <$> userConfig
116− installWidthTable config
116+
117+ when (allowCustomUnicodeWithTables config) $
118+ installWidthTable config
119+
117120 input <- inputForConfig config
118121 out <- outputForConfig config
119122 intMkVty input out
src/Graphics/Vty/Config.hs+4
@@ -148,6 +148,8 @@ data Config = Config
148148 , termName :: Maybe String
149149 -- | Terminal width map files.
150150 , termWidthMaps :: [(String, FilePath)]
151+ -- | Whether to permit custom Unicode width table loading.
152+ , allowCustomUnicodeWithTables :: Bool
151153 } deriving (Show, Eq)
152154
153155defaultConfig :: Config
@@ -166,6 +168,7 @@ instance Semigroup Config where
166168 , outputFd = outputFd c1 <|> outputFd c0
167169 , termName = termName c1 <|> termName c0
168170 , termWidthMaps = termWidthMaps c1 <|> termWidthMaps c0
171+ , allowCustomUnicodeWithTables = allowCustomUnicodeWithTables c1
169172 }
170173
171174instance Monoid Config where
@@ -180,6 +183,7 @@ instance Monoid Config where
180183 , outputFd = Nothing
181184 , termName = Nothing
182185 , termWidthMaps = []
186+ , allowCustomUnicodeWithTables = True
183187 }
184188#if !(MIN_VERSION_base(4,11,0))
185189 mappend = (<>)