From 5961413f411f993ca067aaf1dd5bf13e3ac5c9eb Mon Sep 17 00:00:00 2001 From: AJ Kerrigan Date: Fri, 1 Sep 2023 11:29:55 -0400 Subject: [PATCH] [sheets] fix splitcell to handle attribute/text displayer tuples 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. --- visidata/sheets.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/visidata/sheets.py b/visidata/sheets.py index 2654b6004..c17261a44 100644 --- a/visidata/sheets.py +++ b/visidata/sheets.py @@ -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