Config: make allowCustomUnicodeWithTables more usable in Semigroup instance

This commit is contained in:
Jonathan Daugherty 2020-03-03 09:19:01 -08:00
parent 18ee5fe883
commit 8ecdb953e4
2 changed files with 6 additions and 4 deletions

View File

@ -114,7 +114,7 @@ mkVty :: Config -> IO Vty
mkVty appConfig = do
config <- (<> appConfig) <$> userConfig
when (allowCustomUnicodeWithTables config) $
when (allowCustomUnicodeWithTables config /= Just False) $
installWidthTable config
input <- inputForConfig config

View File

@ -149,8 +149,10 @@ data Config =
-- The default is the value of the TERM environment variable.
, termWidthMaps :: [(String, FilePath)]
-- ^ Terminal width map files.
, allowCustomUnicodeWithTables :: Bool
, allowCustomUnicodeWithTables :: Maybe Bool
-- ^ Whether to permit custom Unicode width table loading.
-- 'Just False' indicates that table loading should not be
-- performed. Other values permit table loading.
}
deriving (Show, Eq)
@ -171,7 +173,7 @@ instance Semigroup Config where
, termName = termName c1 <|> termName c0
, termWidthMaps = termWidthMaps c1 <|> termWidthMaps c0
, allowCustomUnicodeWithTables =
allowCustomUnicodeWithTables c0 || allowCustomUnicodeWithTables c1
allowCustomUnicodeWithTables c1 <|> allowCustomUnicodeWithTables c0
}
instance Monoid Config where
@ -186,7 +188,7 @@ instance Monoid Config where
, outputFd = Nothing
, termName = Nothing
, termWidthMaps = []
, allowCustomUnicodeWithTables = True
, allowCustomUnicodeWithTables = Nothing
}
#if !(MIN_VERSION_base(4,11,0))
mappend = (<>)