packages feed

vty 5.2.7 → 5.2.8

raw patch · 5 files changed

+13/−107 lines, 5 filesdep ~blaze-builderdep ~lensdep ~utf8-string

Dependency ranges changed: blaze-builder, lens, utf8-string

Files

CHANGELOG view
@@ -1,3 +1,10 @@+5.2.8+  - blaze-builder, lens, utf8-string version constraint bump+      - Thanks glguy+      - https://github.com/coreyoconnor/vty/pull/67+  - Do not differentiate based on TERM_PROGRAM+      - https://github.com/coreyoconnor/vty/issues/68+ 5.2.7   - lens and deepseq constraint bump + misc       - Thanks ethercrow
src/Graphics/Vty/Output.hs view
@@ -33,7 +33,6 @@ import Graphics.Vty.Config  import Graphics.Vty.Output.Interface-import Graphics.Vty.Output.MacOSX as MacOSX import Graphics.Vty.Output.XTermColor as XTermColor import Graphics.Vty.Output.TerminfoBased as TerminfoBased @@ -58,40 +57,15 @@ -- -- Selection of a terminal is done as follows: -----      * If TERM == xterm---          then the terminal might be one of the Mac OS X .app terminals. Check if that might be---          the case and use MacOSX if so.---          otherwise use XTermColor.---+--      * If TERM == xterm use XTermColor. --      * for any other TERM value TerminfoBased is used. ----- To differentiate between Mac OS X terminals this uses the TERM_PROGRAM environment variable.--- However, an xterm started by Terminal or iTerm *also* has TERM_PROGRAM defined since the--- environment variable is not reset/cleared by xterm. However a Terminal.app or iTerm.app started--- from an xterm under X11 on mac os x will likely be done via open. Since this does not propogate--- environment variables (I think?) this assumes that XTERM_VERSION will never be set for a true--- Terminal.app or iTerm.app session.--- -- \todo add an implementation for windows that does not depend on terminfo. Should be installable -- with only what is provided in the haskell platform. Use ansi-terminal outputForConfig :: Config -> IO Output outputForConfig Config{ outputFd = Just fd, termName = Just termName, .. } = do     t <- if "xterm" `isPrefixOf` termName-        then do-            -- the explicit nature of the code below was nice for development, not needed anymore.-            maybeTerminalApp <- getEnv "TERM_PROGRAM"-            case maybeTerminalApp of-                Nothing-                    -> XTermColor.reserveTerminal termName fd-                Just v | v == "Apple_Terminal" || v == "iTerm.app" -                    -> do-                        maybeXterm <- getEnv "XTERM_VERSION"-                        case maybeXterm of-                            Nothing -> MacOSX.reserveTerminal v fd-                            Just _  -> XTermColor.reserveTerminal termName fd-                -- Assume any other terminal that sets TERM_PROGRAM to not be an OS X terminal.app-                -- like terminal?-                _   -> XTermColor.reserveTerminal termName fd+        then XTermColor.reserveTerminal termName fd         -- Not an xterm-like terminal. try for generic terminfo.         else TerminfoBased.reserveTerminal termName fd     return t
− src/Graphics/Vty/Output/MacOSX.hs
@@ -1,63 +0,0 @@--- Copyright Corey O'Connor--- The standard Mac OS X terminals Terminal.app and iTerm both declare themselves to be--- "xterm-color" by default. However the terminfo database for xterm-color included with OS X is--- incomplete. ------ This terminal implementation modifies the standard terminfo terminal as required for complete OS--- X support.-{-# LANGUAGE MagicHash #-}-{-# LANGUAGE FlexibleInstances #-}-{-# LANGUAGE TypeFamilies #-}-module Graphics.Vty.Output.MacOSX ( reserveTerminal )-    where--import Graphics.Vty.Output.Interface-import qualified Graphics.Vty.Output.TerminfoBased as TerminfoBased--import Control.Applicative-import Control.Monad (void)-import Control.Monad.Trans--import System.Posix.IO (fdWrite)-import System.Posix.Types (Fd)---- | for Terminal.app the terminal identifier "xterm" is used. For iTerm.app the terminal identifier--- "xterm-256color" is used.------ This effects the terminfo lookup.-reserveTerminal :: ( Applicative m, MonadIO m ) => String -> Fd -> m Output-reserveTerminal v outFd = do-    let remapTerm "iTerm.app" = "xterm-256color"-        remapTerm _ = "xterm"-        flushedPut :: String -> IO ()-        flushedPut = void . fdWrite outFd-    t <- TerminfoBased.reserveTerminal (remapTerm v) outFd-    return $ t { terminalID = terminalID t ++ " (Mac)"-               , reserveDisplay = terminalAppReserveDisplay flushedPut-               , releaseDisplay = terminalAppReleaseDisplay flushedPut-               }---- | Terminal.app requires the xterm-color smcup and rmcup caps. Not the generic xterm ones.--- Otherwise, Terminal.app expects the xterm caps.-smcupStr, rmcupStr :: String-smcupStr = "\ESC7\ESC[?47h"-rmcupStr = "\ESC[2J\ESC[?47l\ESC8"---- | always smcup then clear the screen on terminal.app------ \todo really?-terminalAppReserveDisplay :: MonadIO m => (String -> IO ()) -> m ()-terminalAppReserveDisplay flushedPut = liftIO $ do-    flushedPut smcupStr-    flushedPut clearScreenStr--terminalAppReleaseDisplay :: MonadIO m => (String -> IO ()) -> m ()-terminalAppReleaseDisplay flushedPut = liftIO $ do-    flushedPut rmcupStr---- | iTerm needs a clear screen after smcup as well.------ \todo but we apply to all mac terminals?-clearScreenStr :: String-clearScreenStr = "\ESC[H\ESC[2J"-
test/VerifyOutput.hs view
@@ -27,22 +27,11 @@         Left (_ :: SomeException) -> return []         Right _ -> return [ verify ("verify " ++ termName ++ " could output a picture")                                    (smokeTestTermNonMac termName)-                          -- this is excessive.-                          , verify ("verify " ++ termName ++ " could output a picture on a Mac.")-                                   (smokeTestTermMac termName)                           ]     )  smokeTestTermNonMac :: String -> Image -> Property smokeTestTermNonMac termName i = liftIOResult $ do-    -- unset the TERM_PROGRAM environment variable if set.-    -- Required to execute regression test for #42 on a mac-    unsetEnv "TERM_PROGRAM"-    smokeTestTerm termName i--smokeTestTermMac :: String -> Image -> Property-smokeTestTermMac termName i = liftIOResult $ do-    setEnv "TERM_PROGRAM" "Apple_Terminal" True     smokeTestTerm termName i  smokeTestTerm :: String -> Image -> IO Result
vty.cabal view
@@ -1,5 +1,5 @@ name:                vty-version:             5.2.7+version:             5.2.8 license:             BSD3 license-file:        LICENSE author:              AUTHORS@@ -43,14 +43,14 @@ library   default-language:    Haskell2010   build-depends:       base >= 4 && < 5,-                       blaze-builder >= 0.3.3.2 && < 0.4,+                       blaze-builder >= 0.3.3.2 && < 0.5,                        bytestring,                        containers,                        data-default >= 0.5.3,                        deepseq >= 1.1 && < 1.5,                        directory,                        filepath >= 1.0 && < 2.0,-                       lens >= 3.9.0.2 && < 4.8,+                       lens >= 3.9.0.2 && < 4.9,                        -- required for nice installation with yi                        hashable >= 1.2,                        mtl >= 1.1.1.0 && < 2.3,@@ -60,7 +60,7 @@                        transformers >= 0.3.0.0,                        text >= 0.11.3,                        unix,-                       utf8-string >= 0.3 && < 0.4,+                       utf8-string >= 0.3 && < 1.1,                        vector >= 0.7    exposed-modules:     Graphics.Vty@@ -90,7 +90,6 @@                        Graphics.Vty.Span                        Graphics.Vty.Output.Mock                        Graphics.Vty.Output.Interface-                       Graphics.Vty.Output.MacOSX                        Graphics.Vty.Output.XTermColor                        Graphics.Vty.Output.TerminfoBased