fix(image): add background reset sequence

This commit is contained in:
Jan De Dobbeleer 2023-05-09 11:37:37 +02:00 committed by Jan De Dobbeleer
parent c57975985f
commit 865374a0f5
2 changed files with 6 additions and 1 deletions

View file

@ -73,6 +73,7 @@ const (
overlineReset = "overliner"
strikethrough = "strikethrough"
strikethroughReset = "strikethroughr"
backgroundReset = "backgroundr"
color16 = "color16"
left = "left"
lineChange = "linechange"
@ -186,6 +187,7 @@ func (ir *ImageRenderer) Init(env platform.Environment) error {
overlineReset: `^(?P<STR>\x1b\[55m)`,
strikethrough: `^(?P<STR>\x1b\[9m)`,
strikethroughReset: `^(?P<STR>\x1b\[29m)`,
backgroundReset: `^(?P<STR>\x1b\[49m)`,
color16: `^(?P<STR>\x1b\[(?P<BC>[349][0-7]|10[0-7]|39)m)`,
left: `^(?P<STR>\x1b\[(\d{1,3})D)`,
lineChange: `^(?P<STR>\x1b\[(\d)[FB])`,
@ -566,6 +568,9 @@ func (ir *ImageRenderer) shouldPrint() bool {
ir.foregroundColor = ir.defaultForegroundColor
ir.backgroundColor = nil
return false
case backgroundReset:
ir.backgroundColor = nil
return false
case bold, italic, underline, overline:
ir.style = sequence
return false

View file

@ -90,7 +90,7 @@
"leading_diamond": "<#00c7fc> \ue285 </><#ffafd2>{</>",
"properties": {
"folder_icon": "\uf07b",
"folder_separator_icon": "\uebcb",
"folder_separator_icon": " \uebcb ",
"home_icon": "home",
"style": "agnoster_full"
},