vty 5.36 → 5.37
raw patch · 5 files changed
+31/−12 lines, 5 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +7/−0
- src/Graphics/Vty/Attributes/Color.hs +1/−1
- src/Graphics/Vty/Output.hs +17/−5
- src/Graphics/Vty/PictureToSpans.hs +5/−5
- vty.cabal +1/−1
CHANGELOG.md view
@@ -1,4 +1,11 @@ +5.37+----++* The Xterm backend is now used when `TERM` matches `rxvt` or `tmux`.+* PictureToSpans now uses `error`, not `fail`, to avoid dependence on+ soon-to-be-removed `MonadFail` instance for `ST` (#248)+ 5.36 ----
src/Graphics/Vty/Attributes/Color.hs view
@@ -125,7 +125,7 @@ term <- catch (Just <$> Terminfo.setupTerm termName') (\(_ :: Terminfo.SetupTermError) -> return Nothing) let getCap cap = term >>= \t -> Terminfo.getCapability t cap- termColors = fromMaybe 0 $ getCap (Terminfo.tiGetNum "colors")+ termColors = fromMaybe 0 $! getCap (Terminfo.tiGetNum "colors") colorterm <- lookupEnv "COLORTERM" return $ if | termColors < 8 -> NoColor
src/Graphics/Vty/Output.hs view
@@ -55,15 +55,15 @@ -- -- Selection of a terminal is done as follows: ----- * If TERM contains "xterm" or "screen", use XTermColor.+-- * If TERM starts with "xterm", "screen" or "tmux", use XTermColor. -- * otherwise use the TerminfoBased driver. outputForConfig :: Config -> IO Output outputForConfig Config{ outputFd = Just fd, termName = Just termName , colorMode = Just colorMode, .. } = do- t <- if "xterm" `isPrefixOf` termName || "screen" `isPrefixOf` termName- then XTermColor.reserveTerminal termName fd colorMode- -- Not an xterm-like terminal. try for generic terminfo.- else TerminfoBased.reserveTerminal termName fd colorMode+ t <- if isXtermLike termName+ then XTermColor.reserveTerminal termName fd colorMode+ -- Not an xterm-like terminal. try for generic terminfo.+ else TerminfoBased.reserveTerminal termName fd colorMode case mouseMode of Just s -> setMode t Mouse s@@ -75,6 +75,18 @@ return t outputForConfig config = (<> config) <$> standardIOConfig >>= outputForConfig++isXtermLike :: String -> Bool+isXtermLike termName =+ any (`isPrefixOf` termName) xtermLikeTerminalNamePrefixes++xtermLikeTerminalNamePrefixes :: [String]+xtermLikeTerminalNamePrefixes =+ [ "xterm"+ , "screen"+ , "tmux"+ , "rxvt"+ ] -- | Sets the cursor position to the given output column and row. --
src/Graphics/Vty/PictureToSpans.hs view
@@ -83,7 +83,7 @@ | otherwise = do layerOps <- mapM (`buildSpans` r) (picLayers pic) case layerOps of- [] -> fail "empty picture"+ [] -> error "empty picture" [ops] -> substituteSkips (picBackground pic) ops -- instead of merging ops after generation the merging can -- be performed as part of snocOp.@@ -113,7 +113,7 @@ -- At this point we decide if the background character is single -- column or not. obviously, single column is easier. case safeWcwidth backgroundChar of- w | w == 0 -> fail $ "invalid background character " ++ show backgroundChar+ w | w == 0 -> error $ "invalid background character " ++ show backgroundChar | w == 1 -> do forM_ [0 .. MVector.length ops - 1] $ \row -> do rowOps <- MVector.read ops row@@ -296,7 +296,7 @@ -> BlitM s () addMaybeClippedJoin name skip remaining offset i0Dim i0 i1 size = do state <- get- when (state^.remaining <= 0) $ fail $ name ++ " with remaining <= 0"+ when (state^.remaining <= 0) $ error $ name ++ " with remaining <= 0" case state^.skip of s | s > size -> put $ state & skip %~ subtract size | s == 0 -> if state^.remaining > i0Dim@@ -316,7 +316,7 @@ | s >= i0Dim -> do put $ state & skip %~ subtract i0Dim addMaybeClipped i1- _ -> fail $ name ++ " has unhandled skip class"+ _ -> error $ name ++ " has unhandled skip class" addUnclippedText :: Attr -> DisplayText -> BlitM s () addUnclippedText a txt = do@@ -344,5 +344,5 @@ ops <- MVector.read theMrowOps row let ops' = Vector.snoc ops op when (spanOpsAffectedColumns ops' > regionWidth theRegion)- $ fail $ "row " ++ show row ++ " now exceeds region width"+ $ error $ "row " ++ show row ++ " now exceeds region width" MVector.write theMrowOps row ops'
vty.cabal view
@@ -1,5 +1,5 @@ name: vty-version: 5.36+version: 5.37 license: BSD3 license-file: LICENSE author: AUTHORS