@@ -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)
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 []
274 , writeRowEnd = writeCapExpr (clearEol terminfoCaps) []
286 , writeRowEnd = writeCapExpr (clearEol terminfoCaps) []
275 , inlineHack = return ()
287 , inlineHack = return ()
@@ -348,6 +360,7 @@ terminfoWriteSetAttr dc terminfoCaps urlsEnabled prevAttr reqAttr diffs =
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 =
376 (sgrArgsForState state)
389 (sgrArgsForState state)
377 `mappend` setItalics
390 `mappend` setItalics
391+ `mappend` setStrikethrough
378 `mappend` setColors
392 `mappend` setColors
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
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
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