diff options
author | Kyle Evans <kevans@FreeBSD.org> | 2018-03-20 20:26:24 +0000 |
---|---|---|
committer | Kyle Evans <kevans@FreeBSD.org> | 2018-03-20 20:26:24 +0000 |
commit | 3224bb3f77ec387ab75c09c5090db58d9be8f938 (patch) | |
tree | 9ed438f659fb7274e6d8b160a570a412ef6b7e5f /stand/lua/color.lua | |
parent | 8fbcc3343fff1404b8a5d11d2516e94965ca7be1 (diff) | |
download | src-3224bb3f77ec387ab75c09c5090db58d9be8f938.tar.gz src-3224bb3f77ec387ab75c09c5090db58d9be8f938.zip |
lualoader: Use less atomic options for resetting colors/attributes
Noted by dteske:
CSI 1m ... CSI 22m
CSI 2m ... CSI 22m
CSI 4m ... CSI 24m
CSI 5m ... CSI 25m
CSI 7m ... CSI 27m
CSI 8m ... CSI 28m
CSI (30-37)m ... CSI 39m
CSI (40-47)m ... CSI 49m
- Provide resetf/resetb to match escapef/escapeb
- Use CSI 22m to undo a bold
This is a more reasonable approach than what was previously taken.
Reported by: dteske
Notes
Notes:
svn path=/head/; revision=331259
Diffstat (limited to 'stand/lua/color.lua')
-rw-r--r-- | stand/lua/color.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/stand/lua/color.lua b/stand/lua/color.lua index 8aa9fe25eba3..88a4798fa094 100644 --- a/stand/lua/color.lua +++ b/stand/lua/color.lua @@ -65,6 +65,13 @@ function color.escapef(color_value) return core.KEYSTR_CSI .. "3" .. color_value .. "m" end +function color.resetf() + if color.disabled then + return '' + end + return core.KEYSTR_CSI .. "39m" +end + function color.escapeb(color_value) if color.disabled then return color_value @@ -72,6 +79,13 @@ function color.escapeb(color_value) return core.KEYSTR_CSI .. "4" .. color_value .. "m" end +function color.resetb() + if color.disabled then + return '' + end + return core.KEYSTR_CSI .. "49m" +end + function color.escape(fg_color, bg_color, attribute) if color.disabled then return "" @@ -98,7 +112,7 @@ function color.highlight(str) end -- We need to reset attributes as well as color scheme here, just in -- case the terminal defaults don't match what we're expecting. - return core.KEYSTR_CSI .. "1m" .. str .. color.default() + return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end return color |