diff --git a/visidata/cliptext.py b/visidata/cliptext.py index c99953912..ebd73434e 100644 --- a/visidata/cliptext.py +++ b/visidata/cliptext.py @@ -174,7 +174,7 @@ def clipdraw(scr, y, x, s, attr, w=None, clear=True, literal=False, **kwargs): return clipdraw_chunks(scr, y, x, chunks, attr, w=w, clear=clear, **kwargs) -def clipdraw_chunks(scr, y, x, chunks, cattr:ColorAttr, w=None, clear=True, literal=False, **kwargs): +def clipdraw_chunks(scr, y, x, chunks, cattr:ColorAttr=ColorAttr(), w=None, clear=True, literal=False, **kwargs): '''Draw `chunks` (sequence of (color:str, text:str) as from iterchunks) at (y,x)-(y,x+w) with curses `attr`, clipping with ellipsis char. If `clear`, clear whole editing area before displaying. Return width drawn (max of w). diff --git a/visidata/color.py b/visidata/color.py index 893accdec..b3853f469 100644 --- a/visidata/color.py +++ b/visidata/color.py @@ -33,7 +33,7 @@ def update(self, b:'ColorAttr') -> 'ColorAttr': @property def attr(self) -> int: a = colors._get_colorpair(self.fg, self.bg, self.colorname) | self.attributes - assert a > 0, a + assert a >= 0, a return a diff --git a/visidata/tests/test_cliptext.py b/visidata/tests/test_cliptext.py index 896730251..0fe120356 100644 --- a/visidata/tests/test_cliptext.py +++ b/visidata/tests/test_cliptext.py @@ -30,7 +30,7 @@ def test_clipdraw_chunks(self): ] scr = Mock() scr.getmaxyx.return_value = (80,25) - visidata.clipdraw_chunks(scr, 0, 0, prechunks, 0, w=5) + visidata.clipdraw_chunks(scr, 0, 0, prechunks, visidata.ColorAttr(), w=5) scr.addstr.assert_has_calls([ call(0, 0, 'x', 0), call(0, 1, 'jso…', 0),