vty 5.22 → 5.23
raw patch · 6 files changed
+40/−8 lines, 6 filesdep ~base
Dependency ranges changed: base
Files
- CHANGELOG.md +8/−0
- src/Graphics/Vty/Attributes.hs +8/−3
- src/Graphics/Vty/DisplayAttributes.hs +3/−0
- src/Graphics/Vty/Image.hs +8/−4
- src/Graphics/Vty/Output/TerminfoBased.hs +12/−0
- vty.cabal +1/−1
CHANGELOG.md view
@@ -1,3 +1,11 @@+5.23+ - Added support for italicized output when terminfo supports it. This+ takes the form of a new Style, "italic". Note that most terminfo+ descriptors do not report capabilities for italics, so support for+ this will be very spotty.+ - Updateed text/string function documentation to indicate that escapes+ are not permitted in their inputs.+ 5.22 - Added Graphics.Vty.Attributes.Color240.color240CodeToRGB function (thanks Brent Carmer)
src/Graphics/Vty/Attributes.hs view
@@ -38,6 +38,7 @@ , Style , withStyle , standout+ , italic , underline , reverseVideo , blink@@ -103,14 +104,15 @@ -- __ - unused -- -- Next is the style flags--- SURBDO__+-- SURBDOI_ -- S - standout -- U - underline -- R - reverse video -- B - blink -- D - dim -- O - bold--- __ - unused+-- I - italic+-- _ - unused -- -- Then the foreground color encoded into 8 bits. -- Then the background color encoded into 8 bits.@@ -187,15 +189,18 @@ -- -- * bold/bright --+-- * italic+-- -- (The invisible, protect, and altcharset display attributes some -- terminals support are not supported via VTY.)-standout, underline, reverseVideo, blink, dim, bold :: Style+standout, underline, reverseVideo, blink, dim, bold, italic :: Style standout = 0x01 underline = 0x02 reverseVideo = 0x04 blink = 0x08 dim = 0x10 bold = 0x20+italic = 0x40 defaultStyleMask :: Style defaultStyleMask = 0x00
src/Graphics/Vty/DisplayAttributes.hs view
@@ -94,6 +94,8 @@ data StyleStateChange = ApplyStandout | RemoveStandout+ | ApplyItalic+ | RemoveItalic | ApplyUnderline | RemoveUnderline | ApplyReverseVideo@@ -141,6 +143,7 @@ = mconcat [ styleDiff standout ApplyStandout RemoveStandout , styleDiff underline ApplyUnderline RemoveUnderline+ , styleDiff italic ApplyItalic RemoveItalic , styleDiff reverseVideo ApplyReverseVideo RemoveReverseVideo , styleDiff blink ApplyBlink RemoveBlink , styleDiff dim ApplyDim RemoveDim
src/Graphics/Vty/Image.hs view
@@ -113,12 +113,14 @@ vertCat :: [Image] -> Image vertCat = foldr vertJoin EmptyImage --- | Make an 'Image' from a lazy text value.+-- | Make an 'Image' from a lazy text value. This function should not be+-- given a text value containing escapes. text :: Attr -> TL.Text -> Image text a txt = let displayWidth = safeWcswidth (TL.unpack txt) in HorizText a txt displayWidth (fromIntegral $! TL.length txt) --- | Make an 'Image' from a text value.+-- | Make an 'Image' from a text value. This function should not be+-- given a text value containing escapes. text' :: Attr -> T.Text -> Image text' a txt = let displayWidth = safeWcswidth (T.unpack txt) in HorizText a (TL.fromStrict txt) displayWidth (T.length txt)@@ -132,7 +134,8 @@ -- | Make an image from a string of characters layed out on a single -- row with the same display attribute. The string is assumed to be a--- sequence of ISO-10646 characters.+-- sequence of ISO-10646 characters. This function should not be given a+-- string containing escapes. -- -- Note: depending on how the Haskell compiler represents string -- literals, a string literal in a UTF-8 encoded source file, for@@ -149,7 +152,8 @@ -- -- This is an alias for iso10646String since the usual case is that a -- literal string like "foo" is represented internally as a list of ISO--- 10646 31 bit characters.+-- 10646 31 bit characters. This function should not be given a string+-- containing escapes. -- -- Note: Keep in mind that GHC will compile source encoded as UTF-8 -- but the literal strings, while UTF-8 encoded in the source, will be
src/Graphics/Vty/Output/TerminfoBased.hs view
@@ -62,6 +62,8 @@ { setAttrStates :: Maybe CapExpression , enterStandout :: Maybe CapExpression , exitStandout :: Maybe CapExpression+ , enterItalic :: Maybe CapExpression+ , exitItalic :: Maybe CapExpression , enterUnderline :: Maybe CapExpression , exitUnderline :: Maybe CapExpression , enterReverseVideo :: Maybe CapExpression@@ -227,6 +229,8 @@ <*> probeCap ti "sgr" <*> probeCap ti "smso" <*> probeCap ti "rmso"+ <*> probeCap ti "sitm"+ <*> probeCap ti "ritm" <*> probeCap ti "smul" <*> probeCap ti "rmul" <*> probeCap ti "rev"@@ -434,6 +438,7 @@ data DisplayAttrState = DisplayAttrState { applyStandout :: Bool , applyUnderline :: Bool+ , applyItalic :: Bool , applyReverseVideo :: Bool , applyBlink :: Bool , applyDim :: Bool@@ -444,6 +449,7 @@ sgrArgsForState attrState = map (\b -> if b then 1 else 0) [ applyStandout attrState , applyUnderline attrState+ , applyItalic attrState , applyReverseVideo attrState , applyBlink attrState , applyDim attrState@@ -470,6 +476,8 @@ -- set state cap then just use the set state cap. ( True, True ) -> SetState $ stateForStyle s where+ noEnterExitCap ApplyItalic = isNothing $ enterItalic caps+ noEnterExitCap RemoveItalic = isNothing $ exitItalic caps noEnterExitCap ApplyStandout = isNothing $ enterStandout caps noEnterExitCap RemoveStandout = isNothing $ exitStandout caps noEnterExitCap ApplyUnderline = isNothing $ enterUnderline caps@@ -482,6 +490,8 @@ noEnterExitCap RemoveDim = True noEnterExitCap ApplyBold = isNothing $ enterBoldMode caps noEnterExitCap RemoveBold = True+ enterExitCap ApplyItalic = fromJust $ enterItalic caps+ enterExitCap RemoveItalic = fromJust $ exitItalic caps enterExitCap ApplyStandout = fromJust $ enterStandout caps enterExitCap RemoveStandout = fromJust $ exitStandout caps enterExitCap ApplyUnderline = fromJust $ enterUnderline caps@@ -495,6 +505,7 @@ stateForStyle s = DisplayAttrState { applyStandout = isStyleSet standout , applyUnderline = isStyleSet underline+ , applyItalic = isStyleSet italic , applyReverseVideo = isStyleSet reverseVideo , applyBlink = isStyleSet blink , applyDim = isStyleSet dim@@ -506,6 +517,7 @@ styleToApplySeq s = concat [ applyIfRequired ApplyStandout standout , applyIfRequired ApplyUnderline underline+ , applyIfRequired ApplyItalic italic , applyIfRequired ApplyReverseVideo reverseVideo , applyIfRequired ApplyBlink blink , applyIfRequired ApplyDim dim
vty.cabal view
@@ -1,5 +1,5 @@ name: vty-version: 5.22+version: 5.23 license: BSD3 license-file: LICENSE author: AUTHORS