Repository: saulpw/visidata

Issue:
`v` for expanding lines doesn't work
**Small description**

When I press `V` to see lines expanded the latest vd from `develop` version gives me an error. 
Stable version behaves properly. 

**Expected result**

**Actual result with screenshot**
If you get an unexpected error, please include the full stack trace that you get with `Ctrl-E`.

```
Traceback (most recent call last):
  File "/Users/user/miniconda3/lib/python3.11/site-packages/visidata/mainloop.py", line 38, in drawSheet
    sheet.draw(scr)
  File "/Users/user/miniconda3/lib/python3.11/site-packages/visidata/sheets.py", line 710, in draw
    y += self.drawRow(scr, row, self.topRowIndex+rowidx, y, rowcattr, maxheight=self.windowHeight-y-1, **drawparams)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/lib/python3.11/site-packages/visidata/sheets.py", line 772, in drawRow
    height = min(self.calc_height(row, displines), maxheight) or 1  # display even empty rows
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/lib/python3.11/site-packages/visidata/sheets.py", line 737, in calc_height
    lines = _splitcell(self, cellval.display, width=colwidth-2)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/lib/python3.11/site-packages/visidata/extensible.py", line 133, in call_if_not
    return func(self, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/user/miniconda3/lib/python3.11/site-packages/visidata/sheets.py", line 26, in _splitcell
    for L in s.splitlines():
             ^^^^^^^^^^^^
AttributeError: 'generator' object has no attribute 'splitlines'
```

**Steps to reproduce with sample data and a .vd**
`echo "abc" | vd -f txt -N`

press `v`

Please attach the commandlog (saved with `Ctrl-D`) to show the steps that led to the issue.


**Additional context**
Please include the version of VisiData and Python.
saul.pw/VisiData v2.12dev
Python 3.11.4 (main, Jul  5 2023, 08:40:20) [Clang 14.0.6 ] on darwin


Discussion:
<img width="784" alt="image" src="https://github.com/saulpw/visidata/assets/4896754/6bb3683f-ba37-4c78-a943-006e4eab5ff1">

Hey thanks for reporting this @maxim-uvarov ! I ran into it recently too and assumed I did something silly. Just took a peek though and it looks like this stems from a [change](https://github.com/saulpw/visidata/commit/7c10dbd6aa9855b43f055f64e85053128ec9df86#diff-68091b4f06e91380032246290cf4bf16a651cd410de837d4439ddf0609dc3c22R246-R253) in 7c10dbd6aa9855b43f055f64e85053128ec9df86. Will get a PR together that should address it, and then we can kick around whether or not it addresses it properly :grin: .

Resolving patch:
diff --git a/visidata/sheets.py b/visidata/sheets.py
--- 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


Test patch: