Graphics.Vty.Config: add and export currentTerminalName function

This commit is contained in:
Jonathan Daugherty 2020-03-02 14:24:14 -08:00
parent 771dee8ae1
commit e882198035

View File

@ -66,6 +66,7 @@ module Graphics.Vty.Config
, parseConfigFile
, defaultConfig
, getTtyEraseChar
, currentTerminalName
, widthTableFilename
, vtyDataDirectory
@ -195,10 +196,16 @@ userConfig = do
widthTableFilename :: String -> String
widthTableFilename term = "width_table_" <> term <> ".dat"
termVariable :: String
termVariable = "TERM"
currentTerminalName :: IO (Maybe String)
currentTerminalName = lookupEnv termVariable
terminalWidthTablePath :: IO (Maybe FilePath)
terminalWidthTablePath = do
dataDir <- vtyDataDirectory
result <- lookupEnv "TERM"
result <- lookupEnv termVariable
case result of
Nothing -> return Nothing
Just term -> do
@ -213,7 +220,7 @@ overrideEnvConfig = do
-- can raise 'VtyConfigurationError'.
standardIOConfig :: IO Config
standardIOConfig = do
mb <- lookupEnv "TERM"
mb <- lookupEnv termVariable
case mb of
Nothing -> throwIO VtyMissingTermEnvVar
Just t ->