on master help sign in
Graphics.Vty.Config: add and export currentTerminalName function
commite8821980358565e1464cb54fbdb6beb480ef1686 authorJonathan Daugherty <cygnus@foobox.com> dateMon 2 Mar 2020, 14:24 (7 years ago) parent771dee8
1 file changed+9−2
src/Graphics/Vty/Config.hs+9−2
src/Graphics/Vty/Config.hs+9−2
@@ -66,6 +66,7 @@ module Graphics.Vty.Config
6666 , parseConfigFile
6767 , defaultConfig
6868 , getTtyEraseChar
69+ , currentTerminalName
6970
7071 , widthTableFilename
7172 , vtyDataDirectory
@@ -195,10 +196,16 @@ userConfig = do
195196widthTableFilename :: String -> String
196197widthTableFilename term = "width_table_" <> term <> ".dat"
197198
199+termVariable :: String
200+termVariable = "TERM"
201+
202+currentTerminalName :: IO (Maybe String)
203+currentTerminalName = lookupEnv termVariable
204+
198205terminalWidthTablePath :: IO (Maybe FilePath)
199206terminalWidthTablePath = do
200207 dataDir <- vtyDataDirectory
201− result <- lookupEnv "TERM"
208+ result <- lookupEnv termVariable
202209 case result of
203210 Nothing -> return Nothing
204211 Just term -> do
@@ -213,7 +220,7 @@ overrideEnvConfig = do
213220-- can raise 'VtyConfigurationError'.
214221standardIOConfig :: IO Config
215222standardIOConfig = do
216− mb <- lookupEnv "TERM"
223+ mb <- lookupEnv termVariable
217224 case mb of
218225 Nothing -> throwIO VtyMissingTermEnvVar
219226 Just t ->