diff options
author | Björn Linse <bjorn.linse@gmail.com> | 2019-11-02 10:55:40 +0100 |
---|---|---|
committer | Björn Linse <bjorn.linse@gmail.com> | 2019-11-02 11:01:58 +0100 |
commit | 33cdff1b5cf2912b7630a892c08a46041a989a69 (patch) | |
tree | e0fee474a79fd8627c222aa9a481254a914efe8e | |
parent | cbaba190018a65d9de268702fc9616176bb2be0f (diff) | |
download | rneovim-33cdff1b5cf2912b7630a892c08a46041a989a69.tar.gz rneovim-33cdff1b5cf2912b7630a892c08a46041a989a69.tar.bz2 rneovim-33cdff1b5cf2912b7630a892c08a46041a989a69.zip |
test/screen: make snapshot_util() work properly in rgb_cterm mode
-rw-r--r-- | test/functional/ui/screen.lua | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/test/functional/ui/screen.lua b/test/functional/ui/screen.lua index b57e13fea1..05caaade93 100644 --- a/test/functional/ui/screen.lua +++ b/test/functional/ui/screen.lua @@ -1362,6 +1362,7 @@ function Screen:linegrid_check_attrs(attrs) if self._rgb_cterm then attr_rgb, attr_cterm, info = unpack(v) attr = {attr_rgb, attr_cterm} + info = info or {} elseif self._options.ext_hlstate then attr, info = unpack(v) else @@ -1400,11 +1401,12 @@ end function Screen:_pprint_hlitem(item) -- print(inspect(item)) local multi = self._rgb_cterm or self._options.ext_hlstate - local attrdict = "{"..self:_pprint_attrs(multi and item[1] or item).."}" + local cterm = (not self._rgb_cterm and not self._options.rgb) + local attrdict = "{"..self:_pprint_attrs(multi and item[1] or item, cterm).."}" local attrdict2, hlinfo local descdict = "" if self._rgb_cterm then - attrdict2 = ", {"..self:_pprint_attrs(item[2]).."}" + attrdict2 = ", {"..self:_pprint_attrs(item[2], true).."}" hlinfo = item[3] else attrdict2 = "" @@ -1433,13 +1435,15 @@ function Screen:_pprint_hlinfo(states) end -function Screen:_pprint_attrs(attrs) +function Screen:_pprint_attrs(attrs, cterm) local items = {} for f, v in pairs(attrs) do local desc = tostring(v) if f == "foreground" or f == "background" or f == "special" then if Screen.colornames[v] ~= nil then desc = "Screen.colors."..Screen.colornames[v] + elseif cterm then + desc = tostring(v) else desc = string.format("tonumber('0x%06x')",v) end |