on master help sign in
Merge pull request #1 from jtdaugherty/master
598b014Willem Van Onsem
CHANGELOG.md+28
@@ -1,4 +1,32 @@
1
1
2+5.32
3+----
4+
5+New features:
6+ * Meta-PageUp and Meta-PageDown are now supported (#193)
7+ * Added `supportsItalics` and `supportsStrikethrough` functions to
8+ check for feature support in terminfo
9+
10+Bug fixes:
11+ * Detect utf-8 mode in `LANG` regardless of case (thanks Emeka
12+ Nkurumeh)
13+
14+5.31
15+----
16+
17+New features and API changes:
18+ * Added support for strikethrough mode. This change adds a new
19+ `strikethrough` `Style` value and uses the `smxx` and `rmxx`
20+ Terminfo capabilities to activate and deactivate strikethrough mode,
21+ respectively. If the terminfo does not report those capabilities,
22+ this style is ignored.
23+ * `Output`: added the `setDisplayBounds` field to set the output
24+ dimensions of the output handle; added an implementation of this for
25+ the `TerminfoBased` backend.
26+
27+Other changes:
28+ * The C prototype for `vty_c_get_window_size` in `gwinsz.h` was fixed.
29+
25.30
305.30
3----
31----
4
32
src/Data/Sequence/Extra.hs+1−1
@@ -7,7 +7,7 @@ import Data.Sequence
7import Control.Parallel.Strategies
7import Control.Parallel.Strategies
8
8
9instance NFData a => NFData (Seq a) where
9instance NFData a => NFData (Seq a) where
10− rnf = \v -> rnf' (viewl v)
10+ rnf = rnf' . viewl
11 where
11 where
12 rnf' EmptyL = ()
12 rnf' EmptyL = ()
13 rnf' (a :< r) = rnf a >| rnf' (viewl r)
13 rnf' (a :< r) = rnf a >| rnf' (viewl r)
src/Data/Terminfo/Parse.hs+5−5
@@ -39,7 +39,7 @@ instance Show CapExpression where
39 ++ " <= " ++ show (sourceString c)
39 ++ " <= " ++ show (sourceString c)
40 where
40 where
41 hexDump :: [Word8] -> String
41 hexDump :: [Word8] -> String
42− hexDump = foldr (\b s -> showHex b s) ""
42+ hexDump = foldr showHex ""
43
43
44instance NFData CapExpression where
44instance NFData CapExpression where
45 rnf (CapExpression ops !_bytes !str !c !pOps)
45 rnf (CapExpression ops !_bytes !str !c !pOps)
@@ -99,7 +99,7 @@ parseCapExpression capString =
99 Left e -> Left e
99 Left e -> Left e
100 Right buildResults -> Right $ constructCapExpression capString buildResults
100 Right buildResults -> Right $ constructCapExpression capString buildResults
101
101
102−constructCapExpression :: [Char] -> BuildResults -> CapExpression
102+constructCapExpression :: String -> BuildResults -> CapExpression
103constructCapExpression capString buildResults =
103constructCapExpression capString buildResults =
104 let expr = CapExpression
104 let expr = CapExpression
105 { capOps = outCapOps buildResults
105 { capOps = outCapOps buildResults
@@ -336,9 +336,9 @@ data BuildResults = BuildResults
336instance Semigroup BuildResults where
336instance Semigroup BuildResults where
337 v0 <> v1
337 v0 <> v1
338 = BuildResults
338 = BuildResults
339− { outParamCount = (outParamCount v0) `max` (outParamCount v1)
339+ { outParamCount = outParamCount v0 `max` outParamCount v1
340− , outCapOps = (outCapOps v0) <> (outCapOps v1)
340+ , outCapOps = outCapOps v0 <> outCapOps v1
341− , outParamOps = (outParamOps v0) <> (outParamOps v1)
341+ , outParamOps = outParamOps v0 <> outParamOps v1
342 }
342 }
343
343
344instance Monoid BuildResults where
344instance Monoid BuildResults where
src/Graphics/Vty/Attributes.hs+8−13
@@ -1,7 +1,4 @@
1{-# LANGUAGE CPP #-}
1{-# LANGUAGE CPP #-}
2−{-# LANGUAGE StandaloneDeriving #-}
3−{-# LANGUAGE GADTs #-}
4−{-# LANGUAGE RankNTypes #-}
5{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE DeriveGeneric #-}
6{-# LANGUAGE DeriveAnyClass #-}
3{-# LANGUAGE DeriveAnyClass #-}
7
4
@@ -43,6 +40,7 @@ module Graphics.Vty.Attributes
43 , withStyle
40 , withStyle
44 , standout
41 , standout
45 , italic
42 , italic
43+ , strikethrough
46 , underline
44 , underline
47 , reverseVideo
45 , reverseVideo
48 , blink
46 , blink
@@ -145,20 +143,14 @@ data FixedAttr = FixedAttr
145-- | The style and color attributes can either be the terminal defaults.
143-- | The style and color attributes can either be the terminal defaults.
146-- Or be equivalent to the previously applied style. Or be a specific
144-- Or be equivalent to the previously applied style. Or be a specific
147-- value.
145-- value.
148−data MaybeDefault v where
146+data MaybeDefault v = Default | KeepCurrent | SetTo !v
149− Default :: MaybeDefault v
147+ deriving (Eq, Read, Show)
150− KeepCurrent :: MaybeDefault v
151− SetTo :: forall v . ( Eq v, Show v, Read v ) => !v -> MaybeDefault v
152
148
153instance (NFData v) => NFData (MaybeDefault v) where
149instance (NFData v) => NFData (MaybeDefault v) where
154 rnf Default = ()
150 rnf Default = ()
155 rnf KeepCurrent = ()
151 rnf KeepCurrent = ()
156 rnf (SetTo v) = rnf v
152 rnf (SetTo v) = rnf v
157
153
158−deriving instance Eq v => Eq (MaybeDefault v)
159−deriving instance Eq v => Show (MaybeDefault v)
160−deriving instance (Eq v, Show v, Read v) => Read (MaybeDefault v)
161−
162instance Eq v => Semigroup (MaybeDefault v) where
154instance Eq v => Semigroup (MaybeDefault v) where
163 Default <> Default = Default
155 Default <> Default = Default
164 Default <> KeepCurrent = Default
156 Default <> KeepCurrent = Default
@@ -181,7 +173,7 @@ instance Eq v => Monoid ( MaybeDefault v ) where
181-- if the style attribute should not be applied.
173-- if the style attribute should not be applied.
182type Style = Word8
174type Style = Word8
183
175
184−-- | The 7 possible style attributes:
176+-- | Valid style attributes include:
185--
177--
186-- * standout
178-- * standout
187--
179--
@@ -197,9 +189,11 @@ type Style = Word8
197--
189--
198-- * italic
190-- * italic
199--
191--
192+-- * strikethrough (via the smxx/rmxx terminfo capabilities)
193+--
200-- (The invisible, protect, and altcharset display attributes some
194-- (The invisible, protect, and altcharset display attributes some
201-- terminals support are not supported via VTY.)
195-- terminals support are not supported via VTY.)
202−standout, underline, reverseVideo, blink, dim, bold, italic :: Style
196+standout, underline, reverseVideo, blink, dim, bold, italic, strikethrough :: Style
203standout = 0x01
197standout = 0x01
204underline = 0x02
198underline = 0x02
205reverseVideo = 0x04
199reverseVideo = 0x04
@@ -207,6 +201,7 @@ blink = 0x08
207dim = 0x10
201dim = 0x10
208bold = 0x20
202bold = 0x20
209italic = 0x40
203italic = 0x40
204+strikethrough = 0x80
210
205
211defaultStyleMask :: Style
206defaultStyleMask :: Style
212defaultStyleMask = 0x00
207defaultStyleMask = 0x00
src/Graphics/Vty/DisplayAttributes.hs+3
@@ -96,6 +96,8 @@ data StyleStateChange
96 | RemoveStandout
96 | RemoveStandout
97 | ApplyItalic
97 | ApplyItalic
98 | RemoveItalic
98 | RemoveItalic
99+ | ApplyStrikethrough
100+ | RemoveStrikethrough
99 | ApplyUnderline
101 | ApplyUnderline
100 | RemoveUnderline
102 | RemoveUnderline
101 | ApplyReverseVideo
103 | ApplyReverseVideo
@@ -144,6 +146,7 @@ diffStyles prev cur
144 [ styleDiff standout ApplyStandout RemoveStandout
146 [ styleDiff standout ApplyStandout RemoveStandout
145 , styleDiff underline ApplyUnderline RemoveUnderline
147 , styleDiff underline ApplyUnderline RemoveUnderline
146 , styleDiff italic ApplyItalic RemoveItalic
148 , styleDiff italic ApplyItalic RemoveItalic
149+ , styleDiff strikethrough ApplyStrikethrough RemoveStrikethrough
147 , styleDiff reverseVideo ApplyReverseVideo RemoveReverseVideo
150 , styleDiff reverseVideo ApplyReverseVideo RemoveReverseVideo
148 , styleDiff blink ApplyBlink RemoveBlink
151 , styleDiff blink ApplyBlink RemoveBlink
149 , styleDiff dim ApplyDim RemoveDim
152 , styleDiff dim ApplyDim RemoveDim
src/Graphics/Vty/Input/Classify.hs+3−3
@@ -24,7 +24,7 @@ import qualified Data.Set as S( fromList, member )
24import Data.Char
24import Data.Char
25import Data.Word
25import Data.Word
26
26
27−compile :: ClassifyMap -> [Char] -> KClass
27+compile :: ClassifyMap -> String -> KClass
28compile table = cl' where
28compile table = cl' where
29 -- take all prefixes and create a set of these
29 -- take all prefixes and create a set of these
30 prefixSet = S.fromList $ concatMap (init . inits . fst) $ table
30 prefixSet = S.fromList $ concatMap (init . inits . fst) $ table
@@ -51,7 +51,7 @@ compile table = cl' where
51 -- neither a prefix or a full event.
51 -- neither a prefix or a full event.
52 [] -> Invalid
52 [] -> Invalid
53
53
54−classify :: ClassifyMap -> [Char] -> KClass
54+classify :: ClassifyMap -> String -> KClass
55classify table =
55classify table =
56 let standardClassifier = compile table
56 let standardClassifier = compile table
57 in \s -> case s of
57 in \s -> case s of
@@ -64,7 +64,7 @@ classify table =
64 c:cs | ord c >= 0xC2 -> classifyUtf8 c cs
64 c:cs | ord c >= 0xC2 -> classifyUtf8 c cs
65 _ -> standardClassifier s
65 _ -> standardClassifier s
66
66
67−classifyUtf8 :: Char -> [Char] -> KClass
67+classifyUtf8 :: Char -> String -> KClass
68classifyUtf8 c cs =
68classifyUtf8 c cs =
69 let n = utf8Length (ord c)
69 let n = utf8Length (ord c)
70 (codepoint,rest) = splitAt n (c:cs)
70 (codepoint,rest) = splitAt n (c:cs)
src/Graphics/Vty/Input/Classify/Types.hs+1−1
@@ -8,7 +8,7 @@ where
8import Graphics.Vty.Input.Events
8import Graphics.Vty.Input.Events
9
9
10data KClass
10data KClass
11− = Valid Event [Char]
11+ = Valid Event String
12 -- ^ A valid event was parsed. Any unused characters from the input
12 -- ^ A valid event was parsed. Any unused characters from the input
13 -- stream are also provided.
13 -- stream are also provided.
14 | Invalid
14 | Invalid
src/Graphics/Vty/Input/Loop.hs+1−1
@@ -224,7 +224,7 @@ logInitialInputState input classifyTable = case _inputDebug input of
224 Just h -> do
224 Just h -> do
225 Config{ vmin = Just theVmin
225 Config{ vmin = Just theVmin
226 , vtime = Just theVtime
226 , vtime = Just theVtime
227− , termName = Just theTerm, .. } <- readIORef $ _configRef input
227+ , termName = Just theTerm } <- readIORef $ _configRef input
228 _ <- hPrintf h "initial (vmin,vtime): %s\n" (show (theVmin, theVtime))
228 _ <- hPrintf h "initial (vmin,vtime): %s\n" (show (theVmin, theVtime))
229 forM_ classifyTable $ \i -> case i of
229 forM_ classifyTable $ \i -> case i of
230 (inBytes, EvKey k mods) -> hPrintf h "map %s %s %s %s\n" (show theTerm)
230 (inBytes, EvKey k mods) -> hPrintf h "map %s %s %s %s\n" (show theTerm)
src/Graphics/Vty/Input/Terminfo.hs+5−3
@@ -74,7 +74,7 @@ visibleChars = [ ([x], EvKey (KChar x) [])
74ctrlChars :: ClassifyMap
74ctrlChars :: ClassifyMap
75ctrlChars =
75ctrlChars =
76 [ ([toEnum x],EvKey (KChar y) [MCtrl])
76 [ ([toEnum x],EvKey (KChar y) [MCtrl])
77− | (x,y) <- zip ([0..31]) ('@':['a'..'z']++['['..'_'])
77+ | (x,y) <- zip [0..31] ('@':['a'..'z']++['['..'_'])
78 , y /= 'i' -- Resolve issue #3 where CTRL-i hides TAB.
78 , y /= 'i' -- Resolve issue #3 where CTRL-i hides TAB.
79 , y /= 'h' -- CTRL-h should not hide BS
79 , y /= 'h' -- CTRL-h should not hide BS
80 ]
80 ]
@@ -86,8 +86,10 @@ ctrlMetaChars = map (\(s,EvKey c m) -> ('\ESC':s, EvKey c (MMeta:m))) ctrlChars
86-- | Esc, meta-esc, delete, meta-delete, enter, meta-enter.
86-- | Esc, meta-esc, delete, meta-delete, enter, meta-enter.
87specialSupportKeys :: ClassifyMap
87specialSupportKeys :: ClassifyMap
88specialSupportKeys =
88specialSupportKeys =
89+ [ ("\ESC\ESC[5~",EvKey KPageUp [MMeta])
90+ , ("\ESC\ESC[6~",EvKey KPageDown [MMeta])
89− [ -- special support for ESC
91+ -- special support for ESC
90− ("\ESC",EvKey KEsc []), ("\ESC\ESC",EvKey KEsc [MMeta])
92+ , ("\ESC",EvKey KEsc []), ("\ESC\ESC",EvKey KEsc [MMeta])
91 -- Special support for backspace
93 -- Special support for backspace
92 , ("\DEL",EvKey KBS []), ("\ESC\DEL",EvKey KBS [MMeta])
94 , ("\DEL",EvKey KBS []), ("\ESC\DEL",EvKey KBS [MMeta])
93 -- Special support for Enter
95 -- Special support for Enter
src/Graphics/Vty/Output/Interface.hs+22
@@ -101,6 +101,22 @@ data Output = Output
101 , ringTerminalBell :: IO ()
101 , ringTerminalBell :: IO ()
102 -- | Returns whether the terminal has an audio bell feature.
102 -- | Returns whether the terminal has an audio bell feature.
103 , supportsBell :: IO Bool
103 , supportsBell :: IO Bool
104+ -- | Returns whether the terminal supports italicized text.
105+ --
106+ -- This is terminal-dependent and should make a best effort to
107+ -- determine whether this feature is supported, but even if the
108+ -- terminal advertises support (e.g. via terminfo) that might not
109+ -- be a reliable indicator of whether the feature will work as
110+ -- desired.
111+ , supportsItalics :: IO Bool
112+ -- | Returns whether the terminal supports strikethrough text.
113+ --
114+ -- This is terminal-dependent and should make a best effort to
115+ -- determine whether this feature is supported, but even if the
116+ -- terminal advertises support (e.g. via terminfo) that might not
117+ -- be a reliable indicator of whether the feature will work as
118+ -- desired.
119+ , supportsStrikethrough :: IO Bool
104 }
120 }
105
121
106displayContext :: Output -> DisplayRegion -> IO DisplayContext
122displayContext :: Output -> DisplayRegion -> IO DisplayContext
@@ -191,6 +207,12 @@ outputPicture dc pic = do
191 AbsoluteCursor x y ->
207 AbsoluteCursor x y ->
192 writeShowCursor dc `mappend`
208 writeShowCursor dc `mappend`
193 writeMoveCursor dc (clampX x) (clampY y)
209 writeMoveCursor dc (clampX x) (clampY y)
210+ PositionOnly isAbs x y ->
211+ if isAbs
212+ then writeMoveCursor dc (clampX x) (clampY y)
213+ else let (ox, oy) = charToOutputPos m (clampX x, clampY y)
214+ m = cursorOutputMap ops $ picCursor pic
215+ in writeMoveCursor dc (clampX ox) (clampY oy)
194 Cursor x y ->
216 Cursor x y ->
195 let m = cursorOutputMap ops $ picCursor pic
217 let m = cursorOutputMap ops $ picCursor pic
196 (ox, oy) = charToOutputPos m (clampX x, clampY y)
218 (ox, oy) = charToOutputPos m (clampX x, clampY y)
src/Graphics/Vty/Output/Mock.hs+2
@@ -48,6 +48,8 @@ mockTerminal r = liftIO $ do
48 , releaseDisplay = return ()
48 , releaseDisplay = return ()
49 , ringTerminalBell = return ()
49 , ringTerminalBell = return ()
50 , supportsBell = return False
50 , supportsBell = return False
51+ , supportsItalics = return False
52+ , supportsStrikethrough = return False
51 , setDisplayBounds = const $ return ()
53 , setDisplayBounds = const $ return ()
52 , displayBounds = return r
54 , displayBounds = return r
53 , outputByteBuffer = \bytes -> do
55 , outputByteBuffer = \bytes -> do
src/Graphics/Vty/Output/TerminfoBased.hs+28−2
@@ -68,6 +68,8 @@ data DisplayAttrCaps = DisplayAttrCaps
68 , exitStandout :: Maybe CapExpression
68 , exitStandout :: Maybe CapExpression
69 , enterItalic :: Maybe CapExpression
69 , enterItalic :: Maybe CapExpression
70 , exitItalic :: Maybe CapExpression
70 , exitItalic :: Maybe CapExpression
71+ , enterStrikethrough :: Maybe CapExpression
72+ , exitStrikethrough :: Maybe CapExpression
71 , enterUnderline :: Maybe CapExpression
73 , enterUnderline :: Maybe CapExpression
72 , exitUnderline :: Maybe CapExpression
74 , exitUnderline :: Maybe CapExpression
73 , enterReverseVideo :: Maybe CapExpression
75 , enterReverseVideo :: Maybe CapExpression
@@ -166,6 +168,10 @@ reserveTerminal termName outFd = do
166 sendCap setDefaultAttr []
168 sendCap setDefaultAttr []
167 maybeSendCap cnorm []
169 maybeSendCap cnorm []
168 , supportsBell = return $ isJust $ ringBellAudio terminfoCaps
170 , supportsBell = return $ isJust $ ringBellAudio terminfoCaps
171+ , supportsItalics = return $ (isJust $ enterItalic (displayAttrCaps terminfoCaps)) &&
172+ (isJust $ exitItalic (displayAttrCaps terminfoCaps))
173+ , supportsStrikethrough = return $ (isJust $ enterStrikethrough (displayAttrCaps terminfoCaps)) &&
174+ (isJust $ exitStrikethrough (displayAttrCaps terminfoCaps))
169 , ringTerminalBell = maybeSendCap ringBellAudio []
175 , ringTerminalBell = maybeSendCap ringBellAudio []
170 , reserveDisplay = do
176 , reserveDisplay = do
171 -- If there is no support for smcup: Clear the screen
177 -- If there is no support for smcup: Clear the screen
@@ -203,7 +209,7 @@ reserveTerminal termName outFd = do
203 , assumedStateRef = newAssumedStateRef
209 , assumedStateRef = newAssumedStateRef
204 -- I think fix would help assure tActual is the only
210 -- I think fix would help assure tActual is the only
205 -- reference. I was having issues tho.
211 -- reference. I was having issues tho.
206− , mkDisplayContext = \tActual -> terminfoDisplayContext tActual terminfoCaps
212+ , mkDisplayContext = (`terminfoDisplayContext` terminfoCaps)
207 }
213 }
208 sendCap s = sendCapToTerminal t (s terminfoCaps)
214 sendCap s = sendCapToTerminal t (s terminfoCaps)
209 maybeSendCap s = when (isJust $ s terminfoCaps) . sendCap (fromJust . s)
215 maybeSendCap s = when (isJust $ s terminfoCaps) . sendCap (fromJust . s)
@@ -235,6 +241,8 @@ currentDisplayAttrCaps ti
235 <*> probeCap ti "rmso"
241 <*> probeCap ti "rmso"
236 <*> probeCap ti "sitm"
242 <*> probeCap ti "sitm"
237 <*> probeCap ti "ritm"
243 <*> probeCap ti "ritm"
244+ <*> probeCap ti "smxx"
245+ <*> probeCap ti "rmxx"
238 <*> probeCap ti "smul"
246 <*> probeCap ti "smul"
239 <*> probeCap ti "rmul"
247 <*> probeCap ti "rmul"
240 <*> probeCap ti "rev"
248 <*> probeCap ti "rev"
@@ -270,7 +278,11 @@ terminfoDisplayContext tActual terminfoCaps r = return dc
270 , writeSetAttr = terminfoWriteSetAttr dc terminfoCaps
278 , writeSetAttr = terminfoWriteSetAttr dc terminfoCaps
271 , writeDefaultAttr = \urlsEnabled ->
279 , writeDefaultAttr = \urlsEnabled ->
272 writeCapExpr (setDefaultAttr terminfoCaps) [] `mappend`
280 writeCapExpr (setDefaultAttr terminfoCaps) [] `mappend`
273− (if urlsEnabled then writeURLEscapes EndLink else mempty)
281+ (if urlsEnabled then writeURLEscapes EndLink else mempty) `mappend`
282+ (case exitStrikethrough $ displayAttrCaps terminfoCaps of
283+ Just cap -> writeCapExpr cap []
284+ Nothing -> mempty
285+ )
274 , writeRowEnd = writeCapExpr (clearEol terminfoCaps) []
286 , writeRowEnd = writeCapExpr (clearEol terminfoCaps) []
275 , inlineHack = return ()
287 , inlineHack = return ()
276 }
288 }
@@ -348,6 +360,7 @@ terminfoWriteSetAttr dc terminfoCaps urlsEnabled prevAttr reqAttr diffs =
348 )
360 )
349 (sgrArgsForState state)
361 (sgrArgsForState state)
350 `mappend` setItalics
362 `mappend` setItalics
363+ `mappend` setStrikethrough
351 `mappend` setColors
364 `mappend` setColors
352 -- Otherwise the display colors are not changing or changing
365 -- Otherwise the display colors are not changing or changing
353 -- between two non-default points.
366 -- between two non-default points.
@@ -375,6 +388,7 @@ terminfoWriteSetAttr dc terminfoCaps urlsEnabled prevAttr reqAttr diffs =
375 )
388 )
376 (sgrArgsForState state)
389 (sgrArgsForState state)
377 `mappend` setItalics
390 `mappend` setItalics
391+ `mappend` setStrikethrough
378 `mappend` setColors
392 `mappend` setColors
379 where
393 where
380 urlAttrs True = writeURLEscapes (urlDiff diffs)
394 urlAttrs True = writeURLEscapes (urlDiff diffs)
@@ -392,6 +406,11 @@ terminfoWriteSetAttr dc terminfoCaps urlsEnabled prevAttr reqAttr diffs =
392 , Just sitm <- enterItalic (displayAttrCaps terminfoCaps)
406 , Just sitm <- enterItalic (displayAttrCaps terminfoCaps)
393 = writeCapExpr sitm []
407 = writeCapExpr sitm []
394 | otherwise = mempty
408 | otherwise = mempty
409+ setStrikethrough
410+ | hasStyle (fixedStyle attr) strikethrough
411+ , Just smxx <- enterStrikethrough (displayAttrCaps terminfoCaps)
412+ = writeCapExpr smxx []
413+ | otherwise = mempty
395 setColors =
414 setColors =
396 (case fixedForeColor attr of
415 (case fixedForeColor attr of
397 Just c -> writeCapExpr (setForeColor terminfoCaps)
416 Just c -> writeCapExpr (setForeColor terminfoCaps)
@@ -460,6 +479,7 @@ data DisplayAttrState = DisplayAttrState
460 { applyStandout :: Bool
479 { applyStandout :: Bool
461 , applyUnderline :: Bool
480 , applyUnderline :: Bool
462 , applyItalic :: Bool
481 , applyItalic :: Bool
482+ , applyStrikethrough :: Bool
463 , applyReverseVideo :: Bool
483 , applyReverseVideo :: Bool
464 , applyBlink :: Bool
484 , applyBlink :: Bool
465 , applyDim :: Bool
485 , applyDim :: Bool
@@ -496,6 +516,8 @@ reqDisplayCapSeqFor caps s diffs
496 -- set state cap then just use the set state cap.
516 -- set state cap then just use the set state cap.
497 ( True, True ) -> SetState $ stateForStyle s
517 ( True, True ) -> SetState $ stateForStyle s
498 where
518 where
519+ noEnterExitCap ApplyStrikethrough = isNothing $ enterStrikethrough caps
520+ noEnterExitCap RemoveStrikethrough = isNothing $ exitStrikethrough caps
499 noEnterExitCap ApplyItalic = isNothing $ enterItalic caps
521 noEnterExitCap ApplyItalic = isNothing $ enterItalic caps
500 noEnterExitCap RemoveItalic = isNothing $ exitItalic caps
522 noEnterExitCap RemoveItalic = isNothing $ exitItalic caps
501 noEnterExitCap ApplyStandout = isNothing $ enterStandout caps
523 noEnterExitCap ApplyStandout = isNothing $ enterStandout caps
@@ -510,6 +532,8 @@ reqDisplayCapSeqFor caps s diffs
510 noEnterExitCap RemoveDim = True
532 noEnterExitCap RemoveDim = True
511 noEnterExitCap ApplyBold = isNothing $ enterBoldMode caps
533 noEnterExitCap ApplyBold = isNothing $ enterBoldMode caps
512 noEnterExitCap RemoveBold = True
534 noEnterExitCap RemoveBold = True
535+ enterExitCap ApplyStrikethrough = fromJust $ enterStrikethrough caps
536+ enterExitCap RemoveStrikethrough = fromJust $ exitStrikethrough caps
513 enterExitCap ApplyItalic = fromJust $ enterItalic caps
537 enterExitCap ApplyItalic = fromJust $ enterItalic caps
514 enterExitCap RemoveItalic = fromJust $ exitItalic caps
538 enterExitCap RemoveItalic = fromJust $ exitItalic caps
515 enterExitCap ApplyStandout = fromJust $ enterStandout caps
539 enterExitCap ApplyStandout = fromJust $ enterStandout caps
@@ -526,6 +550,7 @@ stateForStyle s = DisplayAttrState
526 { applyStandout = isStyleSet standout
550 { applyStandout = isStyleSet standout
527 , applyUnderline = isStyleSet underline
551 , applyUnderline = isStyleSet underline
528 , applyItalic = isStyleSet italic
552 , applyItalic = isStyleSet italic
553+ , applyStrikethrough = isStyleSet strikethrough
529 , applyReverseVideo = isStyleSet reverseVideo
554 , applyReverseVideo = isStyleSet reverseVideo
530 , applyBlink = isStyleSet blink
555 , applyBlink = isStyleSet blink
531 , applyDim = isStyleSet dim
556 , applyDim = isStyleSet dim
@@ -538,6 +563,7 @@ styleToApplySeq s = concat
538 [ applyIfRequired ApplyStandout standout
563 [ applyIfRequired ApplyStandout standout
539 , applyIfRequired ApplyUnderline underline
564 , applyIfRequired ApplyUnderline underline
540 , applyIfRequired ApplyItalic italic
565 , applyIfRequired ApplyItalic italic
566+ , applyIfRequired ApplyStrikethrough strikethrough
541 , applyIfRequired ApplyReverseVideo reverseVideo
567 , applyIfRequired ApplyReverseVideo reverseVideo
542 , applyIfRequired ApplyBlink blink
568 , applyIfRequired ApplyBlink blink
543 , applyIfRequired ApplyDim dim
569 , applyIfRequired ApplyDim dim
src/Graphics/Vty/Output/XTermColor.hs+4−3
@@ -17,6 +17,7 @@ import Blaze.ByteString.Builder.Word (writeWord8)
17
17
18import Control.Monad (void, when)
18import Control.Monad (void, when)
19import Control.Monad.Trans
19import Control.Monad.Trans
20+import Data.Char (toLower)
20import Data.IORef
21import Data.IORef
21
22
22import System.Posix.IO (fdWrite)
23import System.Posix.IO (fdWrite)
@@ -92,9 +93,9 @@ reserveTerminal variant outFd = liftIO $ do
92utf8Active :: IO Bool
93utf8Active :: IO Bool
93utf8Active = do
94utf8Active = do
94 let vars = ["LC_ALL", "LANG", "LC_CTYPE"]
95 let vars = ["LC_ALL", "LANG", "LC_CTYPE"]
95− results <- catMaybes <$> mapM getEnv vars
96+ results <- map (toLower <$>) . catMaybes <$> mapM getEnv vars
96− let matches = filter ("UTF8" `isInfixOf`) results <>
97+ let matches = filter ("utf8" `isInfixOf`) results <>
97− filter ("UTF-8" `isInfixOf`) results
98+ filter ("utf-8" `isInfixOf`) results
98 return $ not $ null matches
99 return $ not $ null matches
99
100
100-- | Enable bracketed paste mode:
101-- | Enable bracketed paste mode:
src/Graphics/Vty/Picture.hs+8
@@ -82,6 +82,14 @@ data Cursor =
82 NoCursor
82 NoCursor
83 -- | Show the cursor at the given logical column accounting for
83 -- | Show the cursor at the given logical column accounting for
84 -- character width in the presence of multi-column characters.
84 -- character width in the presence of multi-column characters.
85+ | PositionOnly !Bool !Int !Int
86+ -- | Set the terminal's cursor position without displaying a cursor
87+ -- character. This is important for accessibility with screen
88+ -- readers where a cursor position needs to be reported but we may
89+ -- not want to show a block cursor in that location for cosmetic
90+ -- reasons. The boolean argument indicates whether the positioning
91+ -- should be absolute as with 'AbsoluteCursor' ('True') or logical
92+ -- as with 'Cursor' ('False').
85 | Cursor !Int !Int
93 | Cursor !Int !Int
86 -- | Show the cursor at the given absolute terminal column and row
94 -- | Show the cursor at the given absolute terminal column and row
87 | AbsoluteCursor !Int !Int
95 | AbsoluteCursor !Int !Int
src/Graphics/Vty/PictureToSpans.hs+1−1
@@ -81,7 +81,7 @@ combinedOpsForLayers :: Picture -> DisplayRegion -> ST s (MRowOps s)
81combinedOpsForLayers pic r
81combinedOpsForLayers pic r
82 | regionWidth r == 0 || regionHeight r == 0 = MVector.new 0
82 | regionWidth r == 0 || regionHeight r == 0 = MVector.new 0
83 | otherwise = do
83 | otherwise = do
84− layerOps <- mapM (\layer -> buildSpans layer r) (picLayers pic)
84+ layerOps <- mapM (`buildSpans` layer) (picLayers pic)
85 case layerOps of
85 case layerOps of
86 [] -> fail "empty picture"
86 [] -> fail "empty picture"
87 [ops] -> substituteSkips (picBackground pic) ops
87 [ops] -> substituteSkips (picBackground pic) ops
vty.cabal+2−2
@@ -1,5 +1,5 @@
1name: vty
1name: vty
2−version: 5.30
2+version: 5.32
3license: BSD3
3license: BSD3
4license-file: LICENSE
4license-file: LICENSE
5author: AUTHORS
5author: AUTHORS
@@ -45,7 +45,7 @@ library
45 deepseq >= 1.1 && < 1.5,
45 deepseq >= 1.1 && < 1.5,
46 directory,
46 directory,
47 filepath >= 1.0 && < 2.0,
47 filepath >= 1.0 && < 2.0,
48− microlens < 0.4.12,
48+ microlens < 0.4.13,
49 microlens-mtl,
49 microlens-mtl,
50 microlens-th,
50 microlens-th,
51 hashable >= 1.2,
51 hashable >= 1.2,