Skip to content

Commit

Permalink
[sheets] fix splitcell to handle attribute/text displayer tuples
Browse files Browse the repository at this point in the history
Have splitcell account for receiving a list of (attr, text) tuples
rather than a list of text lines.

Return a list of (attr, line) for each wrapped line of text.
  • Loading branch information
ajkerrigan committed Sep 1, 2023
1 parent 0ba5a11 commit 5961413
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions visidata/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ def _splitcell(sheet, s, width=0):
return [s]

ret = []
for L in s.splitlines():
ret.extend(textwrap.wrap(L, width=width, break_long_words=False, replace_whitespace=False))
for attr, text in s:
ret.extend([(attr, line)] for line in textwrap.wrap(
text, width=width, break_long_words=False, replace_whitespace=False
))
return ret

disp_column_fill = ' ' # pad chars after column value
Expand Down

0 comments on commit 5961413

Please sign in to comment.