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

View file

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