aboutsummaryrefslogtreecommitdiffstats
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
parent233688e5c7c8f35366a02673e04dad2e527897e1 (diff)
downloadchawan-051d22b17e4c270f925376824a2307ab65ef5aa5.tar.gz
Implement blink tag
with text-decoration: blink.
-rw-r--r--res/ua.css4
-rw-r--r--src/io/cell.nim5
-rw-r--r--src/render/renderdocument.nim2
3 files changed, 11 insertions, 0 deletions
diff --git a/res/ua.css b/res/ua.css
index 1659f65d..bfcfce3c 100644
--- a/res/ua.css
+++ b/res/ua.css
@@ -193,3 +193,7 @@ dl[compact] dt + br {
center {
text-align: -moz-center;
}
+
+blink {
+ text-decoration: blink;
+}
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]))
diff --git a/src/render/renderdocument.nim b/src/render/renderdocument.nim
index 2d4dac82..ce353168 100644
--- a/src/render/renderdocument.nim
+++ b/src/render/renderdocument.nim
@@ -23,6 +23,8 @@ func formatFromWord(computed: ComputedFormat): Format =
result.overline = true
if computed.textdecoration == TEXT_DECORATION_LINE_THROUGH:
result.strike = true
+ if computed.textdecoration == TEXT_DECORATION_BLINK:
+ result.blink = true
proc setRowWord(lines: var FlexibleGrid, word: InlineWord, x, y: int, term: TermAttributes) =
var r: Rune