mirror of
https://github.com/ilyakooo0/vty.git
synced 2024-12-01 14:36:27 +03:00
Config: add allowCustomUnicodeWithTables to control whether a custom table load is ever attempted
This commit is contained in:
parent
9edfd029cb
commit
9737f2b4ee
@ -113,7 +113,10 @@ data Vty = Vty
|
|||||||
mkVty :: Config -> IO Vty
|
mkVty :: Config -> IO Vty
|
||||||
mkVty appConfig = do
|
mkVty appConfig = do
|
||||||
config <- (<> appConfig) <$> userConfig
|
config <- (<> appConfig) <$> userConfig
|
||||||
|
|
||||||
|
when (allowCustomUnicodeWithTables config) $
|
||||||
installWidthTable config
|
installWidthTable config
|
||||||
|
|
||||||
input <- inputForConfig config
|
input <- inputForConfig config
|
||||||
out <- outputForConfig config
|
out <- outputForConfig config
|
||||||
intMkVty input out
|
intMkVty input out
|
||||||
|
@ -148,6 +148,8 @@ data Config = Config
|
|||||||
, termName :: Maybe String
|
, termName :: Maybe String
|
||||||
-- | Terminal width map files.
|
-- | Terminal width map files.
|
||||||
, termWidthMaps :: [(String, FilePath)]
|
, termWidthMaps :: [(String, FilePath)]
|
||||||
|
-- | Whether to permit custom Unicode width table loading.
|
||||||
|
, allowCustomUnicodeWithTables :: Bool
|
||||||
} deriving (Show, Eq)
|
} deriving (Show, Eq)
|
||||||
|
|
||||||
defaultConfig :: Config
|
defaultConfig :: Config
|
||||||
@ -166,6 +168,7 @@ instance Semigroup Config where
|
|||||||
, outputFd = outputFd c1 <|> outputFd c0
|
, outputFd = outputFd c1 <|> outputFd c0
|
||||||
, termName = termName c1 <|> termName c0
|
, termName = termName c1 <|> termName c0
|
||||||
, termWidthMaps = termWidthMaps c1 <|> termWidthMaps c0
|
, termWidthMaps = termWidthMaps c1 <|> termWidthMaps c0
|
||||||
|
, allowCustomUnicodeWithTables = allowCustomUnicodeWithTables c1
|
||||||
}
|
}
|
||||||
|
|
||||||
instance Monoid Config where
|
instance Monoid Config where
|
||||||
@ -180,6 +183,7 @@ instance Monoid Config where
|
|||||||
, outputFd = Nothing
|
, outputFd = Nothing
|
||||||
, termName = Nothing
|
, termName = Nothing
|
||||||
, termWidthMaps = []
|
, termWidthMaps = []
|
||||||
|
, allowCustomUnicodeWithTables = True
|
||||||
}
|
}
|
||||||
#if !(MIN_VERSION_base(4,11,0))
|
#if !(MIN_VERSION_base(4,11,0))
|
||||||
mappend = (<>)
|
mappend = (<>)
|
||||||
|
Loading…
Reference in New Issue
Block a user