about summary refs log tree commit diff stats
path: root/src/io/cell.nim
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2022-02-12 13:11:38 +0100
committerbptato <nincsnevem662@gmail.com>2022-02-12 13:11:44 +0100
commit051d22b17e4c270f925376824a2307ab65ef5aa5 (patch)
tree34245c30f6a7569a0bb7cba76ed24e8a3243f338 /src/io/cell.nim
parent233688e5c7c8f35366a02673e04dad2e527897e1 (diff)
downloadchawan-051d22b17e4c270f925376824a2307ab65ef5aa5.tar.gz
Implement blink tag
with text-decoration: blink.
Diffstat (limited to 'src/io/cell.nim')
-rw-r--r--src/io/cell.nim5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/io/cell.nim b/src/io/cell.nim
index 7009a12a..b08d11e6 100644
--- a/src/io/cell.nim
+++ b/src/io/cell.nim
@@ -17,6 +17,7 @@ type
     FLAG_REVERSE
     FLAG_STRIKE
     FLAG_OVERLINE
+    FLAG_BLINK
 
   Format* = object
     fgcolor*: CellColor
@@ -49,6 +50,7 @@ const FormatCodes: array[FormatFlags, tuple[s: int, e: int]] = [
   FLAG_REVERSE: (7, 27),
   FLAG_STRIKE: (9, 29),
   FLAG_OVERLINE: (53, 55),
+  FLAG_BLINK: (5, 25),
 ]
 
 template flag_template(format: Format, val: bool, flag: FormatFlags) =
@@ -61,6 +63,7 @@ template `underline=`*(f: var Format, b: bool) = flag_template f, b, FLAG_UNDERL
 template `reverse=`*(f: var Format, b: bool) = flag_template f, b, FLAG_REVERSE
 template `strike=`*(f: var Format, b: bool) = flag_template f, b, FLAG_STRIKE
 template `overline=`*(f: var Format, b: bool) = flag_template f, b, FLAG_OVERLINE
+template `blink=`*(f: var Format, b: bool) = flag_template f, b, FLAG_BLINK
 
 #TODO ?????
 func `==`*(a: FixedCell, b: FixedCell): bool =
@@ -171,10 +174,12 @@ proc handleAnsiCode(format: var Format, final: char, params: string) =
           of 1: format.bold = true
           of 3: format.italic = true
           of 4: format.underline = true
+          of 5: format.blink = true
           of 7: format.reverse = true
           of 9: format.strike = true
           of 22: format.bold = false
           of 23: format.italic = false
+          of 25: format.blink = false
           of 27: format.reverse = false
           of 29: format.strike = false
           of 30..37: format.fgcolor = CellColor(rgb: false, color: uint8(ip[pi]))