From 5a54ecce1d89842c80fbfba82ac156410f228f59 Mon Sep 17 00:00:00 2001
From: Alex Shinn <alexshinn@gmail.com>
Date: Thu, 23 Jul 2020 17:50:26 +0900
Subject: [PATCH] adding italic and strikethrough ansi escapes

---
 lib/chibi/term/ansi.scm | 38 ++++++++++++++++++++++++++++++++++++--
 lib/chibi/term/ansi.sld |  4 ++++
 2 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/lib/chibi/term/ansi.scm b/lib/chibi/term/ansi.scm
index 39e72b2c..ebde95eb 100644
--- a/lib/chibi/term/ansi.scm
+++ b/lib/chibi/term/ansi.scm
@@ -389,8 +389,42 @@
 ;;>
 ;;> If ANSI escapes are not enabled, return \var{str}.
 
-(define underline (make-wrap-procedure (underline-escape)
-                                       (reset-underline-escape)))
+(define underline
+  (make-wrap-procedure (underline-escape) (reset-underline-escape)))
+
+;;> Return a string consisting of an ANSI escape code to select
+;;> italic style.
+
+(define italic-escape
+  (make-simple-escape-procedure 3))
+
+;;> Return a string consisting of an ANSI escape code to select
+;;> non-italic style.
+
+(define reset-italic-escape
+  (make-simple-escape-procedure 23))
+
+;;> Returns \var{str} optionally wrapped in italic escapes.
+
+(define italic
+  (make-wrap-procedure (italic-escape) (reset-italic-escape)))
+
+;;> Return a string consisting of an ANSI escape code to select
+;;> strikethrough style.
+
+(define strikethrough-escape
+  (make-simple-escape-procedure 9))
+
+;;> Return a string consisting of an ANSI escape code to select
+;;> non-strikethrough style.
+
+(define reset-strikethrough-escape
+  (make-simple-escape-procedure 29))
+
+;;> Returns \var{str} optionally wrapped in strikethrough escapes.
+
+(define strikethrough
+  (make-wrap-procedure (strikethrough-escape) (reset-strikethrough-escape)))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
diff --git a/lib/chibi/term/ansi.sld b/lib/chibi/term/ansi.sld
index a68d9495..5aa4533e 100644
--- a/lib/chibi/term/ansi.sld
+++ b/lib/chibi/term/ansi.sld
@@ -24,12 +24,16 @@
    bold
    underline
    negative
+   italic
+   strikethrough
    rgb rgb-background
    gray gray-background
    rgb24 rgb24-background
    bold-escape reset-bold-escape
    underline-escape reset-underline-escape
    negative-escape reset-negative-escape
+   italic-escape reset-italic-escape
+   strikethrough-escape reset-strikethrough-escape
 
    ansi-escapes-enabled?)
   (import (scheme base)