-
-
Notifications
You must be signed in to change notification settings - Fork 304
Description
Small description
For cells that have dict/list/tuple contents, getDisplayValue()
produces unexpected results that depend on the column width.
Steps to reproduce
echo '{"string": "[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]", "list": [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]}' |vd -f jsonl
Expected result
There are a variety of anomalies with the list column.
- I would expect both columns to be equally wide. But the second column, holding a list, is only wide enough to fit its name
list
. - In a wide window, resizing a narrow list column with
_
causes it to repeatedly increase its width. Each time it more than doubles its width, to 2*col.width
+2, until it reaches about half the window width and can no longer double. syscopy
results are truncated for list cells, but not string cells. For example, start by narrowing thestring
column to width6
withz_
to match thelist
column.zY
onstring
takes the full cell contents:[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
, but on the too-narrowlist
column it takes only[10] 1; 2; …
. The difference in truncation is surprising. And the width of that truncated value is surprising too. It is actually wider than the value shown on screen, which is[10]…
.
Configuration
Anomaly #1 happens in visidata 3.2 but not 3.1.1 due to d1fb235.
Anomaly #2 is a longstanding visidata behavior.
Anomaly #3 is longstanding too.
Additional context
The problem behavior here is for dict/list/tuple columns. It manifests in a variety of ways. I'll use this as a central thread for discussing the getDisplayValue
width-related behavior. And I'll make separate PRs that address the different manifestations.