prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  [unfurl-col] unfurling a column with TypedWrapper halts unfurl
  **Small description**
  When unfurling a column which has a TypedWrapper a sheet loading halt occurs
  
  **Expected result**
  The same response as whatever `options.unfurl_empty` would do for a row without a list.
  
  **Actual result with screenshot**
  AttributeError: 'TypedWrapper' object has no attribute 'xyz'
  ![unfurl](https://user-images.githubusercontent.com/11225502/126625610-ee355763-aa7d-427d-a517-abce6b84adfc.gif)
  
  If you get an unexpected error, please include the full stack trace that you get with `Ctrl-E`.
  
  **Steps to reproduce with sample data and a .vd**
  `echo '[{"a":1,"d":{"b":[1,2,3]}},{"a":2,"d":{"c":[1,2,3]}},{"a":3,"d":{"b":[1,2,3]}}]' | vd -f json`
  
  ```
  sheet	col	row	longname	input	keystrokes	comment
  			open-file	-	o	
  _	d		addcol-expr	curcol['b']	=	create new column from Python expression, with column names as variables
  _	curcol_b_		unfurl-col			row-wise expand current column of lists (e.g. [2]) or dicts (e.g. {3}) within that column
  
  ```
  
  **Additional context**
  v2.6dev
  
  
  </issue>
  <code>
  [start of visidata/unfurl.py]
  1 '''This adds the `unfurl-col` command, to unfurl a column containing iterable values, such as lists and dicts.
  2 Unfurling pushes a new sheet, with each key/value pair in the unfurled column values getting its own row, with the rest of the source sheet's columns copied for each of those rows.
  3 
  4 Note: When unfurling a column, non-iterable objects (numbers, and also strings) are treated as single-item lists, so that they too can be unfurled.
  5 
  6 Credit to Jeremy Singer-Vine for the idea and original implementation.
  7 '''
  8 
  9 from collections.abc import Iterable, Mapping
  10 from visidata import vd, Progress, Sheet, Column, ColumnItem, SettableColumn, SubColumnFunc, asyncthread, clean_to_id
  11 
  12 
  13 vd.option('unfurl_empty', False, 'if unfurl includes rows for empty containers', replay=True)
  14 
  15 
  16 class UnfurledSheet(Sheet):
  17     @asyncthread
  18     def reload(self):
  19         # Copy over base sheet, using SubColumnFunc
  20         self.columns = []
  21         for col in self.source.columns:
  22             if col is self.source_col:
  23                 # Replace iterable column with two columns: keys and values
  24                 self.cursorVisibleColIndex = len(self.columns)-1
  25                 self.addColumn(ColumnItem(col.name + "_key", 1))
  26                 self.addColumn(ColumnItem(col.name + "_value", 2))
  27             else:
  28                 self.addColumn(SubColumnFunc(col.name, col, 0, keycol=col.keycol))
  29 
  30         self.rows = []
  31         unfurl_empty = self.options.unfurl_empty
  32         for row in Progress(self.source.rows):
  33             val = self.source_col.getValue(row)
  34 
  35             if not isinstance(val, Iterable) or isinstance(val, str):
  36                 val = [ val ]
  37 
  38             if isinstance(val, Mapping):
  39                 gen = val.items()
  40             else:
  41                 gen = enumerate(val)
  42 
  43             nadded = 0
  44             for key, sub_value in gen:
  45                 new_row = [ row, key, sub_value ]
  46                 self.addRow(new_row)
  47                 nadded += 1
  48 
  49             if unfurl_empty and not nadded:
  50                 self.addRow([row, None, None])
  51 
  52 @Sheet.api
  53 def unfurl_col(sheet, col):
  54     clean_id = clean_to_id(col.name)
  55     vs = UnfurledSheet(f"{sheet.name}_{clean_id}_unfurled", source=sheet, source_col=col)
  56     return vs
  57 
  58 
  59 Sheet.addCommand("zM", "unfurl-col", "vd.push(unfurl_col(cursorCol))", "row-wise expand current column of lists (e.g. [2]) or dicts (e.g. {3}) within that column")
  60
  [end of visidata/unfurl.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/visidata/unfurl.py b/visidata/unfurl.py
  --- a/visidata/unfurl.py
  +++ b/visidata/unfurl.py
  @@ -8,12 +8,14 @@
   
   from collections.abc import Iterable, Mapping
   from visidata import vd, Progress, Sheet, Column, ColumnItem, SettableColumn, SubColumnFunc, asyncthread, clean_to_id
  +from visidata import stacktrace, TypedExceptionWrapper
   
   
   vd.option('unfurl_empty', False, 'if unfurl includes rows for empty containers', replay=True)
   
   
   class UnfurledSheet(Sheet):
  +    # rowdef: [row, key, sub_value]
       @asyncthread
       def reload(self):
           # Copy over base sheet, using SubColumnFunc
  @@ -30,7 +32,16 @@
           self.rows = []
           unfurl_empty = self.options.unfurl_empty
           for row in Progress(self.source.rows):
  -            val = self.source_col.getValue(row)
  +            try:
  +                val = self.source_col.getValue(row)
  +            except Exception as e:
  +                e.stacktrace = stacktrace()
  +                if unfurl_empty:
  +                    # TypedExceptionWrapper allows the use of z^E to see the stacktrace
  +                    # the exception on its own lacks clarity
  +                    self.addRow([row, TypedExceptionWrapper(None, exception=e), TypedExceptionWrapper(None, exception=e)])
  +                else:
  +                    vd.exceptionCaught(e)
   
               if not isinstance(val, Iterable) or isinstance(val, str):
                   val = [ val ]
  
verification_info: {"golden_diff": "diff --git a/visidata/unfurl.py b/visidata/unfurl.py\n--- a/visidata/unfurl.py\n+++ b/visidata/unfurl.py\n@@ -8,12 +8,14 @@\n \n from collections.abc import Iterable, Mapping\n from visidata import vd, Progress, Sheet, Column, ColumnItem, SettableColumn, SubColumnFunc, asyncthread, clean_to_id\n+from visidata import stacktrace, TypedExceptionWrapper\n \n \n vd.option('unfurl_empty', False, 'if unfurl includes rows for empty containers', replay=True)\n \n \n class UnfurledSheet(Sheet):\n+    # rowdef: [row, key, sub_value]\n     @asyncthread\n     def reload(self):\n         # Copy over base sheet, using SubColumnFunc\n@@ -30,7 +32,16 @@\n         self.rows = []\n         unfurl_empty = self.options.unfurl_empty\n         for row in Progress(self.source.rows):\n-            val = self.source_col.getValue(row)\n+            try:\n+                val = self.source_col.getValue(row)\n+            except Exception as e:\n+                e.stacktrace = stacktrace()\n+                if unfurl_empty:\n+                    # TypedExceptionWrapper allows the use of z^E to see the stacktrace\n+                    # the exception on its own lacks clarity\n+                    self.addRow([row, TypedExceptionWrapper(None, exception=e), TypedExceptionWrapper(None, exception=e)])\n+                else:\n+                    vd.exceptionCaught(e)\n \n             if not isinstance(val, Iterable) or isinstance(val, str):\n                 val = [ val ]\n", "issue": "[unfurl-col] unfurling a column with TypedWrapper halts unfurl\n**Small description**\r\nWhen unfurling a column which has a TypedWrapper a sheet loading halt occurs\r\n\r\n**Expected result**\r\nThe same response as whatever `options.unfurl_empty` would do for a row without a list.\r\n\r\n**Actual result with screenshot**\r\nAttributeError: 'TypedWrapper' object has no attribute 'xyz'\r\n![unfurl](https://user-images.githubusercontent.com/11225502/126625610-ee355763-aa7d-427d-a517-abce6b84adfc.gif)\r\n\r\nIf you get an unexpected error, please include the full stack trace that you get with `Ctrl-E`.\r\n\r\n**Steps to reproduce with sample data and a .vd**\r\n`echo '[{\"a\":1,\"d\":{\"b\":[1,2,3]}},{\"a\":2,\"d\":{\"c\":[1,2,3]}},{\"a\":3,\"d\":{\"b\":[1,2,3]}}]' | vd -f json`\r\n\r\n```\r\nsheet\tcol\trow\tlongname\tinput\tkeystrokes\tcomment\r\n\t\t\topen-file\t-\to\t\r\n_\td\t\taddcol-expr\tcurcol['b']\t=\tcreate new column from Python expression, with column names as variables\r\n_\tcurcol_b_\t\tunfurl-col\t\t\trow-wise expand current column of lists (e.g. [2]) or dicts (e.g. {3}) within that column\r\n\r\n```\r\n\r\n**Additional context**\r\nv2.6dev\r\n\n", "before_files": [{"content": "'''This adds the `unfurl-col` command, to unfurl a column containing iterable values, such as lists and dicts.\nUnfurling pushes a new sheet, with each key/value pair in the unfurled column values getting its own row, with the rest of the source sheet's columns copied for each of those rows.\n\nNote: When unfurling a column, non-iterable objects (numbers, and also strings) are treated as single-item lists, so that they too can be unfurled.\n\nCredit to Jeremy Singer-Vine for the idea and original implementation.\n'''\n\nfrom collections.abc import Iterable, Mapping\nfrom visidata import vd, Progress, Sheet, Column, ColumnItem, SettableColumn, SubColumnFunc, asyncthread, clean_to_id\n\n\nvd.option('unfurl_empty', False, 'if unfurl includes rows for empty containers', replay=True)\n\n\nclass UnfurledSheet(Sheet):\n    @asyncthread\n    def reload(self):\n        # Copy over base sheet, using SubColumnFunc\n        self.columns = []\n        for col in self.source.columns:\n            if col is self.source_col:\n                # Replace iterable column with two columns: keys and values\n                self.cursorVisibleColIndex = len(self.columns)-1\n                self.addColumn(ColumnItem(col.name + \"_key\", 1))\n                self.addColumn(ColumnItem(col.name + \"_value\", 2))\n            else:\n                self.addColumn(SubColumnFunc(col.name, col, 0, keycol=col.keycol))\n\n        self.rows = []\n        unfurl_empty = self.options.unfurl_empty\n        for row in Progress(self.source.rows):\n            val = self.source_col.getValue(row)\n\n            if not isinstance(val, Iterable) or isinstance(val, str):\n                val = [ val ]\n\n            if isinstance(val, Mapping):\n                gen = val.items()\n            else:\n                gen = enumerate(val)\n\n            nadded = 0\n            for key, sub_value in gen:\n                new_row = [ row, key, sub_value ]\n                self.addRow(new_row)\n                nadded += 1\n\n            if unfurl_empty and not nadded:\n                self.addRow([row, None, None])\n\n@Sheet.api\ndef unfurl_col(sheet, col):\n    clean_id = clean_to_id(col.name)\n    vs = UnfurledSheet(f\"{sheet.name}_{clean_id}_unfurled\", source=sheet, source_col=col)\n    return vs\n\n\nSheet.addCommand(\"zM\", \"unfurl-col\", \"vd.push(unfurl_col(cursorCol))\", \"row-wise expand current column of lists (e.g. [2]) or dicts (e.g. {3}) within that column\")\n", "path": "visidata/unfurl.py"}]}