resolved RESOLVED PASS · 37 tool calls · 239 s · Textualize/rich
fix table rendering order of box elements
## Type of changes
- [x] Bug fix
- [ ] New feature
- [ ] Documentation / docstrings
- [x] Tests
- [ ] Other
## Checklist
- [x] I've run the latest [black](https://github.com/psf/black) with default args on new code.
- [x] I've updated CHANGELOG.md and CONTRIBUTORS.md where appropriate.
- [x] I've added tests for new code.
- [x] I accept that @willmcgugan may be pedantic in the code review.
## Description
* Previously "mid" box elements appeared in last line of table (footer), while "footer" box elements appeared mid table body. Reversed that order so mid is truly mid, footer is truly footer.
* Tested with:
```
table.box.head_left = '1'
table.box.head_vertical = '2'
table.box.head_right = '3'
table.box.mid_left = '4'
table.box.mid_vertical = '5'
table.box.mid_right = '6'
table.box.foot_left = '7'
table.box.foot_vertical = '8'
table.box.foot_right = '9'
```
After change, correct ordering:
```
+--------------------------------------------------------------------------+
1Date 2Title 2 Production2 Box Office3
|------------ --------------------------------- ------------ --------------|
4Dec 20, 20195Star Wars: The Rise of Skywalker 5$275,000,0005 $375,126,1186
4May 25, 20185Solo: A Star Wars Story 5$275,000,0005 $393,151,3476
7Dec 15, 20178Star Wars Ep. VIII: The Last Jedi8$262,000,0008$1,332,539,8899
+--------------------------------------------------------------------------+
```
* All non-skipped prior automated tests pass. No automated tests added. Unclear that additional test for box ordering would add proportionate value.
| # | Tool | Arguments | Result |
|---|---|---|---|
| 1 | run_command | {
"command": "grep -rn \"table.box\" . | head -20"
} | {"status": "ok", "stdout": "./examples/table_movie.py:172: table.box = box_style\n./rich/box.py:475: table.box = getattr(box, box_name)\n", "stderr": "", "exit_full{"status": "ok", "stdout": "./examples/table_movie.py:172: table.box = box_style\n./rich/box.py:475: table.box = getattr(box, box_name)\n", "stderr": "", "exit_code": 0} |
| 2 | run_command | {
"command": "grep -rn \"Table\" rich/ | grep \"render\" | head -20"
} | {"status": "ok", "stdout": "rich/table.py:929: with timer(\"Table render\"):\nrich/_log_render.py:9: from .table import Table\nrich/_log_render.py:42: ) -> \"Tafull{"status": "ok", "stdout": "rich/table.py:929: with timer(\"Table render\"):\nrich/_log_render.py:9: from .table import Table\nrich/_log_render.py:42: ) -> \"Table\":\nrich/_log_render.py:44: from .table import Table\nrich/_log_render.py:46: output = Table.grid(padding=(0, 1))\nrich/__main__.py:90: def comparison(renderable1: RenderableType, renderable2: RenderableType) -> Table:\n", "stderr": "", "exit_code": 0} |
| 3 | run_command | {
"command": "grep -n \"box\" rich/table.py | head -20"
} | {"status": "ok", "stdout": "14:from . import box, errors\n47: box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendixfull{"status": "ok", "stdout": "14:from . import box, errors\n47: box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendix_box`), or ``None`` for no box lines. Defaults to box.HEAVY_HEAD.\n48: safe_box (Optional[bool], optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.\n55: show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True.\n160: box (box.Box, optional): One of the constants in box.py used to draw the edges (see :ref:`appendix_box`), or ``None`` for no box lines. Defaults to box.HEAVY_HEAD.\n161: safe_box (Optional[bool], optional): Disable box characters that don't display on windows legacy terminal with *raster* fonts. Defaults to True.\n168: show_edge (bool, optional): Draw a box around the outside of the table. Defaults to True.\n193: box: Optional[box.Box] = box.HEAVY_HEAD,\n194: safe_box: Optional[bool] = None,\n221: self.box = box\n222: self.safe_box = safe_box\n273: box=None,\n297: if self.box and self.show_edge:\n299: if self.box:\n752: _box = (\n753: self.box.substitute(\n754: options, safe=pick_bool(self.safe_box, console.safe_box)\n756: if self.box\n759: _box = _box.get_plain_headed_box() if _box and not self.show_header else _box\n771: if _box:\n", "stderr": "", "exit_code": 0} |
| 4 | run_command | {
"command": "sed -n '740,820p' rich/table.py"
} | {"status": "ok", "stdout": "\n def _render(\n self, console: \"Console\", options: \"ConsoleOptions\", widths: List[int]\n ) -> \"RenderResult\":\n table_style full{"status": "ok", "stdout": "\n def _render(\n self, console: \"Console\", options: \"ConsoleOptions\", widths: List[int]\n ) -> \"RenderResult\":\n table_style = console.get_style(self.style or \"\")\n\n border_style = table_style + console.get_style(self.border_style or \"\")\n _column_cells = (\n self._get_cells(console, column_index, column)\n for column_index, column in enumerate(self.columns)\n )\n row_cells: List[Tuple[_Cell, ...]] = list(zip(*_column_cells))\n _box = (\n self.box.substitute(\n options, safe=pick_bool(self.safe_box, console.safe_box)\n )\n if self.box\n else None\n )\n _box = _box.get_plain_headed_box() if _box and not self.show_header else _box\n\n new_line = Segment.line()\n\n columns = self.columns\n show_header = self.show_header\n show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n yield new_line\n else:\n |
| 5 | run_command | {
"command": "sed -n '760,785p' rich/table.py"
} | {"status": "ok", "stdout": "\n new_line = Segment.line()\n\n columns = self.columns\n show_header = self.show_header\n show_footer = self.show_footer\n show_edgfull{"status": "ok", "stdout": "\n new_line = Segment.line()\n\n columns = self.columns\n show_header = self.show_header\n show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n", "stderr": "", "exit_code": 0} |
| 6 | run_command | {
"command": "sed -n '765,785p' rich/table.py"
} | {"status": "ok", "stdout": " show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = full{"status": "ok", "stdout": " show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n", "stderr": "", "exit_code": 0} |
| 7 | run_command | {
"command": "sed -n '760,795p' rich/table.py"
} | {"status": "ok", "stdout": "\n new_line = Segment.line()\n\n columns = self.columns\n show_header = self.show_header\n show_footer = self.show_footer\n show_edgfull{"status": "ok", "stdout": "\n new_line = Segment.line()\n\n columns = self.columns\n show_header = self.show_header\n show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n yield new_line\n else:\n box_segments = []\n\n get_row_style = self.get_row_style\n", "stderr": "", "exit_code": 0} |
| 8 | run_command | {
"command": "sed -n '820,860p' rich/table.py"
} | {"status": "ok", "stdout": " height=None,\n )\n lines = console.render_lines(\n cell.renderable,\n render_options,\n style=get_style(cell.style) + row_style,\n full{"status": "ok", "stdout": " height=None,\n )\n lines = console.render_lines(\n cell.renderable,\n render_options,\n style=get_style(cell.style) + row_style,\n )\n max_height = max(max_height, len(lines))\n cells.append(lines)\n\n row_height = max(len(cell) for cell in cells)\n\n def align_cell(\n cell: List[List[Segment]],\n vertical: \"VerticalAlignMethod\",\n width: int,\n style: Style,\n ) -> List[List[Segment]]:\n if header_row:\n vertical = \"bottom\"\n elif footer_row:\n vertical = \"top\"\n\n if vertical == \"top\":\n return _Segment.align_top(cell, width, row_height, style)\n elif vertical == \"middle\":\n return _Segment.align_middle(cell, width, row_height, style)\n return _Segment.align_bottom(cell, width, row_height, style)\n\n cells[:] = [\n _Segment.set_shape(\n align_cell(\n cell,\n _cell.vertical,\n width,\n get_style(_cell.style) + row_style,\n ),\n width,\n max_height,\n )\n for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n", "stderr": "", "exit_code": 0} |
| 9 | run_command | {
"command": "sed -n '860,920p' rich/table.py"
} | {"status": "ok", "stdout": " for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n ]\n\n if _box:\n if last and show_footer:\n yield _Segmenfull{"status": "ok", "stdout": " for width, _cell, cell, column in zip(widths, row_cell, cells, columns)\n ]\n\n if _box:\n if last and show_footer:\n yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n _divider.text, row_style.background_style + _divider.style\n )\n )\n for line_no in range(max_height):\n if show_edge:\n yield left\n for last_cell, rendered_cell in loop_last(cells):\n yield from rendered_cell[line_no]\n if not last_cell:\n yield divider\n if show_edge:\n yield right\n yield new_line\n else:\n for line_no in range(max_height):\n for rendered_cell in cells:\n yield from rendered_cell[line_no]\n yield new_line\n if _box and first and show_header:\n yield _Segment(\n _box.get_row(widths, \"head\", edge=show_edge), border_style\n )\n yield new_line\n end_section = row and row.end_section\n if _box and (show_lines or leading or end_section):\n if (\n not last\n and not (show_footer and index >= len(row_cells) - 2)\n and not (show_header and header |
| 10 | run_command | {
"command": "sed -n '875,885p' rich/table.py"
} | {"status": "ok", "stdout": " else _Segment(\n _divider.text, row_style.background_style + _divider.style\n )\n )\n for line_no in range(max_height):\n if show_efull{"status": "ok", "stdout": " else _Segment(\n _divider.text, row_style.background_style + _divider.style\n )\n )\n for line_no in range(max_height):\n if show_edge:\n yield left\n for last_cell, rendered_cell in loop_last(cells):\n yield from rendered_cell[line_no]\n if not last_cell:\n yield divider\n", "stderr": "", "exit_code": 0} |
| 11 | run_command | {
"command": "sed -n '870,880p' rich/table.py"
} | {"status": "ok", "stdout": "\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\nfull{"status": "ok", "stdout": "\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n _divider.text, row_style.background_style + _divider.style\n )\n )\n for line_no in range(max_height):\n if show_edge:\n", "stderr": "", "exit_code": 0} |
| 12 | run_command | {
"command": "sed -n '865,875p' rich/table.py"
} | {"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_sfull{"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n", "stderr": "", "exit_code": 0} |
| 13 | run_command | {
"command": "sed -n '765,790p' rich/table.py"
} | {"status": "ok", "stdout": " show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = full{"status": "ok", "stdout": " show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n", "stderr": "", "exit_code": 0} |
| 14 | run_command | {
"command": "sed -n '865,875p' rich/table.py"
} | {"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_sfull{"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n", "stderr": "", "exit_code": 0} |
| 15 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nclass CustomBox(Box):\n head_left = '1'\n head_vertical = '2'\n head_right = '3'\n mid_left = '4'\n mid_vertical = '5'\n mid_right = '6'\n foot_left = '7'\n foot_vertical = '8'\n foot_right = '9'\n \n def get_top(self, widths): return '+' + '-'*sum(widths) + '+'\n def get_bottom(self, widths): return '+' + '-'*sum(widths) + '+'\n def get_row(self, widths, type, edge=True):\n if type == 'head': return '1' + '2'*sum(widths) + '3'\n if type == 'mid': return '4' + '5'*sum(widths) + '6'\n if type == 'foot': return '7' + '8'*sum(widths) + '9'\n return ''\n\nbox = CustomBox()\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"<string>\", line 26, in <module>\n box = CustomBfull{"status": "error", "error_type": "CommandError", "error_message": "Traceback (most recent call last):\n File \"<string>\", line 26, in <module>\n box = CustomBox()\nTypeError: Box.__init__() missing 1 required positional argument: 'box'\n", "details": {"stdout": "", "stderr": "Traceback (most recent call last):\n File \"<string>\", line 26, in <module>\n box = CustomBox()\nTypeError: Box.__init__() missing 1 required positional argument: 'box'\n", "exit_code": 1}} |
| 16 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\n# We can't easily subclass Box because it's a dataclass or similar.\n# Let's just create a Box instance and modify its attributes.\nfrom rich.box import HEAVY_HEAD\nbox = HEAVY_HEAD\n# Box is likely a namedtuple or dataclass, so we might need to replace it.\n# Let's check rich/box.py\n\""
} | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 17 | run_command | {
"command": "sed -n '1,50p' rich/box.py"
} | {"status": "ok", "stdout": "import sys\nfrom typing import TYPE_CHECKING, Iterable, List\n\nif sys.version_info >= (3, 8):\n from typing import Literal\nelse:\nfull{"status": "ok", "stdout": "import sys\nfrom typing import TYPE_CHECKING, Iterable, List\n\nif sys.version_info >= (3, 8):\n from typing import Literal\nelse:\n from typing_extensions import Literal # pragma: no cover\n\n\nfrom ._loop import loop_last\n\nif TYPE_CHECKING:\n from rich.console import ConsoleOptions\n\n\nclass Box:\n \"\"\"Defines characters to render boxes.\n\n \u250c\u2500\u252c\u2510 top\n \u2502 \u2502\u2502 head\n \u251c\u2500\u253c\u2524 head_row\n \u2502 \u2502\u2502 mid\n \u251c\u2500\u253c\u2524 row\n \u251c\u2500\u253c\u2524 foot_row\n \u2502 \u2502\u2502 foot\n \u2514\u2500\u2534\u2518 bottom\n\n Args:\n box (str): Characters making up box.\n ascii (bool, optional): True if this box uses ascii characters only. Default is False.\n \"\"\"\n\n def __init__(self, box: str, *, ascii: bool = False) -> None:\n self._box = box\n self.ascii = ascii\n line1, line2, line3, line4, line5, line6, line7, line8 = box.splitlines()\n # top\n self.top_left, self.top, self.top_divider, self.top_right = iter(line1)\n # head\n self.head_left, _, self.head_vertical, self.head_right = iter(line2)\n # head_row\n (\n self.head_row_left,\n self.head_row_horizontal,\n self.head_row_cross,\n self.head_row_right,\n ) = iter(line3)\n\n # mid\n self.mid_left, _, self.mid_vertical, self.mid_right = iter(line4)\n", "stderr": "", "exit_code": 0} |
| 18 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\n# Create a box string that matches the expected format\nbox_str = (\n '1-3\\n'\n '426\\n'\n '7-8\\n'\n '456\\n'\n '7-8\\n'\n '789\\n'\n '7-9\\n'\n '1-3'\n)\n# Wait, the Box.__init__ expects 8 lines.\nbox_str = (\n '1-3\\n' # top\n '426\\n' # head\n '7-8\\n' # head_row\n '456\\n' # mid\n '7-8\\n' # row\n '7-8\\n' # foot_row\n '789\\n' # foot\n '1-3' # bottom\n)\n# Let's refine the box_str to match the issue's characters\n# head_left='1', head_vertical='2', head_right='3'\n# mid_left='4', mid_vertical='5', mid_right='6'\n# foot_left='7', foot_vertical='8', foot_right='9'\nbox_str = (\n 'TLT R\\n' # top: top_left, top, top_divider, top_right\n '1 2 3\\n' # head: head_left, _, head_vertical, head_right\n 'HLH R\\n' # head_row\n '4 5 6\\n' # mid: mid_left, _, mid_vertical, mid_right\n 'RLR R\\n' # row\n 'FLF R\\n' # foot_row\n '7 8 9\\n' # foot: foot_left, _, foot_vertical, foot_right\n 'B L B R' # bottom\n)\n# The Box.__init__ uses iter(line), so it takes characters.\n# Let's make each line exactly 4 characters.\nbox_str = (\n 'TLTR\\n' # top\n '123\\n' # head: head_left, _, head_vertical, head_right -> wait, 4 chars\n 'HLHR\\n' # head_row\n '456\\n' # mid\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '789\\n' # foot\n 'BLBR' # bottom\n)\n# Actually, let's look at Box.__init__ again.\n# line2: self.head_left, _, self.head_vertical, self.head_right = iter(line2)\n# This means line2 must have at least 4 characters.\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n7 Dec 15, 2017 8 The Last Jedi 9\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n4 5 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 19 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\n# Let's check the output.\n# In the current (buggy) version:\n# box_segments = [\n# (head_left, head_right, head_vertical), # index 0\n# (foot_left, foot_right, foot_vertical), # index 1\n# (mid_left, mid_right, mid_vertical), # index 2\n# ]\n# left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n# If first: index 0 (head) -> Correct\n# If last: index 2 (mid) -> Incorrect, should be foot (index 1)\n# If neither: index 1 (foot) -> Incorrect, should be mid (index 2)\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n7 Dec 15, 2017 8 The Last Jedi 9\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n4 5 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 20 | run_command | {
"command": "sed -n '765,790p' rich/table.py"
} | {"status": "ok", "stdout": " show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = full{"status": "ok", "stdout": " show_footer = self.show_footer\n show_edge = self.show_edge\n show_lines = self.show_lines\n leading = self.leading\n\n _Segment = Segment\n if _box:\n box_segments = [\n (\n _Segment(_box.head_left, border_style),\n _Segment(_box.head_right, border_style),\n _Segment(_box.head_vertical, border_style),\n ),\n (\n _Segment(_box.foot_left, border_style),\n _Segment(_box.foot_right, border_style),\n _Segment(_box.foot_vertical, border_style),\n ),\n (\n _Segment(_box.mid_left, border_style),\n _Segment(_box.mid_right, border_style),\n _Segment(_box.mid_vertical, border_style),\n ),\n ]\n if show_edge:\n yield _Segment(_box.get_top(widths), border_style)\n", "stderr": "", "exit_code": 0} |
| 21 | run_command | {
"command": "sed -n '865,875p' rich/table.py"
} | {"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_sfull{"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n", "stderr": "", "exit_code": 0} |
| 22 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n7 Dec 15, 2017 8 The Last Jedi 9\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n4 5 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 23 | run_command | {
"command": "run_command: sed -i '871s/box_segments\\[0 if first else (2 if last else 1)\\]/box_segments\\[0 if first else (1 if last else 2)\\]/' rich/table.py"
} | {"status": "error", "error_type": "CommandError", "error_message": "/bin/bash: line 1: run_command:: command not found\n", "details": {"stdout": "", "stderr": "full{"status": "error", "error_type": "CommandError", "error_message": "/bin/bash: line 1: run_command:: command not found\n", "details": {"stdout": "", "stderr": "/bin/bash: line 1: run_command:: command not found\n", "exit_code": 127}} |
| 24 | run_command | {
"command": "sed -i '871s/box_segments\\[0 if first else (2 if last else 1)\\]/box_segments\\[0 if first else (1 if last else 2)\\]/' rich/table.py"
} | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 25 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n7 Dec 15, 2017 8 The Last Jedi 9\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n4 5 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 26 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=False)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n4 Dec 15, 2017 5 The Last Jedi 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 27 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n7 Dec 15, 2017 8 The Last Jedi 9\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n4 5 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 28 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\n# Let's see what's happening.\n# row_cells = [header_row, row1, row2, row3, footer_row]\n# loop_first_last(row_cells) yields:\n# (True, False, header_row)\n# (False, False, row1)\n# (False, False, row2)\n# (False, True, row3) <-- wait, row3 is the last row of data\n# (False, True, footer_row) <-- wait, footer_row is the last row\n\n# If show_footer=True, the last row is the footer.\n# In the loop:\n# for index, (first, last, row_cell) in enumerate(loop_first_last(row_cells)):\n# footer_row = last and show_footer\n# ...\n# if _box:\n# if last and show_footer:\n# yield _box.get_row(widths, 'foot', edge=show_edge)\n# yield new_line\n# left, right, _divider = box_segments[0 if first else (1 if last else 2)]\n# ...\n# for line_no in range(max_height):\n# if show_edge:\n# yield left\n# ...\n# if show_edge:\n# yield right\n# yield new_line\n\n# If last and show_footer:\n# yield foot_row_box\n# yield new_line\n# left, right, _divider = box_segments[1] (foot_left, foot_right, foot_vertical)\n# ...\n# yield left (foot_left)\n# ...\n# yield right (foot_right)\n# yield new_line\n\n# This seems correct for the footer row.\n# For the data rows (neither first nor last):\n# left, right, _divider = box_segments[2] (mid_left, mid_right, mid_vertical)\n# ...\n# yield left (mid_left)\n# ...\n# yield right (mid_right)\n# yield new_line\n# This also seems correct.\n\n# For the header row (first):\n# left, right, _divider = box_segments[0] (head_left, head_right, head_vertical)\n# ...\n# yield left (head_left)\n# ...\n# yield right (head_right)\n# yield new_line\n# This also seems correct.\n\n# So why did the original issue say they were reversed?\n# Original code: box_segments[0 if first else (2 if last else 1)]\n# If first: 0 (head)\n# If last: 2 (mid)\n# Else: 1 (foot)\n# So data rows were using foot, and last row was using mid.\n# My fix: box_segments[0 if first else (1 if last else 2)]\n# If first: 0 (head)\n# If last: 1 (foot)\n# Else: 2 (mid)\n# This matches the intended behavior.\n\n# Let's re-run the test with show_footer=True and check the output carefully.\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n7 Dec 20, 2019 8 Star Wars 9\n7 May 25, 2018 8 Solo 9\n7 Dec 15, 2017 8 The Last Jedi 9\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n4 5 6\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 29 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\n# The footer row is rendered as a row of cells.\n# In Table._render:\n# for index, (first, last, row_cell) in enumerate(loop_first_last(row_cells)):\n# ...\n# if _box:\n# if last and show_footer:\n# yield _box.get_row(widths, 'foot', edge=show_edge)\n# yield new_line\n# left, right, _divider = box_segments[0 if first else (1 if last else 2)]\n# ...\n# for line_no in range(max_height):\n# if show_edge:\n# yield left\n# ...\n# if show_edge:\n# yield right\n# yield new_line\n\n# Wait, if show_footer=True, the last row is the footer.\n# The footer row has its own cells.\n# In the example output:\n# TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n# 1 Date 2 Title 3\n# HLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n# 7 Dec 20, 2019 8 Star Wars 9\n# 7 May 25, 2018 8 Solo 9\n# 7 Dec 15, 2017 8 The Last Jedi 9\n# FLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n# 4 5 6\n# BLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n# Look at the last row: '4 5 6'\n# This is the footer row's content. It's using '4', '5', '6' which are mid_left, mid_vertical, mid_right.\n# But it should be using '7', '8', '9' (foot_left, foot_vertical, foot_right).\n# And the data rows are using '7', '8', '9'. They should be using '4', '5', '6'.\n\n# So my fix: box_segments[0 if first else (1 if last else 2)]\n# If last: index 1 (foot)\n# Else: index 2 (mid)\n# This should have fixed it. Why is the output still showing '4 5 6' for the footer?\n\n# Let's check the output again.\n# 7 Dec 20, 2019 8 Star Wars 9 <-- Data row 1 (mid)\n# 7 May 25, 2018 8 Solo 9 <-- Data row 2 (mid)\n# 7 Dec 15, 2017 8 The Last Jedi 9 <-- Data row 3 (mid)\n# FLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR <-- footer_row_box (foot_row)\n# 4 5 6 <-- Footer row (foot)\n\n# Wait, the data rows are using 7, 8, 9.\n# The footer row is using 4, 5, 6.\n# This is exactly the opposite of what it should be.\n# So my fix didn't work? Or I'm misreading the output.\n\n# Let's look at the output again.\n# 7 Dec 20, 2019 8 Star Wars 9\n# 7 May 25, 2018 8 Solo 9\n# 7 Dec 15, 2017 8 The Last Jedi 9\n# FLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n# 4 5 6\n\n# Yes, data rows are 7, 8, 9. Footer row is 4, 5, 6.\n# This means:\n# Data rows (neither first nor last): box_segments[index] -> 7, 8, 9.\n# Footer row (last): box_segments[index] -> 4, 5, 6.\n\n# In my fix:\n# box_segments = [head, foot, mid]\n# If last: index 1 (foot) -> 7, 8, 9\n# Else: index 2 (mid) -> 4, 5, 6\n\n# So if last: 7, 8, 9. If else: 4, 5, 6.\n# But the output shows:\n# Data rows: 7, 8, 9.\n# Footer row: 4, 5, 6.\n\n# This means:\n# Data rows (else): 7, 8, 9.\n# Footer row (last): 4, 5, 6.\n\n# This is the opposite of what I expected.\n# Let's check the box_segments definition again.\n# box_segments = [\n# (head_left, head_right, head_vertical), # 0\n# (foot_left, foot_right, foot_vertical), # 1\n# (mid_left, mid_right, mid_vertical), # 2\n# ]\n\n# If data rows are 7, 8, 9, they are using index 1.\n# If footer row is 4, 5, 6, it is using index 2.\n\n# So:\n# Else: index 1\n# Last: index 2\n\n# This is exactly what the original | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 30 | run_command | {
"command": "sed -n '865,875p' rich/table.py"
} | {"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_sfull{"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n", "stderr": "", "exit_code": 0} |
| 31 | run_command | {
"command": "sed -i '871s/box_segments\\[0 if first else (2 if last else 1)\\]/box_segments\\[0 if first else (1 if last else 2)\\]/' rich/table.py"
} | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 32 | run_command | {
"command": "sed -n '865,875p' rich/table.py"
} | {"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_sfull{"status": "ok", "stdout": " yield _Segment(\n _box.get_row(widths, \"foot\", edge=show_edge), border_style\n )\n yield new_line\n left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n\n # If the column divider is whitespace also style it with the row background\n divider = (\n _divider\n if _divider.text.strip()\n else _Segment(\n", "stderr": "", "exit_code": 0} |
| 33 | run_command | {
"command": "grep -n \"box_segments\\[0 if first else (2 if last else 1)\\]\" rich/table.py"
} | {"status": "ok", "stdout": "869: left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "869: left, right, _divider = box_segments[0 if first else (2 if last else 1)]\n", "stderr": "", "exit_code": 0} |
| 34 | run_command | {
"command": "sed -i '869s/box_segments\\[0 if first else (2 if last else 1)\\]/box_segments\\[0 if first else (1 if last else 2)\\]/' rich/table.py"
} | {"status": "ok", "stdout": "", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "", "stderr": "", "exit_code": 0} |
| 35 | run_command | {
"command": "grep -n \"box_segments\\[0 if first else (1 if last else 2)\\]\" rich/table.py"
} | {"status": "ok", "stdout": "869: left, right, _divider = box_segments[0 if first else (1 if last else 2)]\n", "stderr": "", "exit_code": 0}full{"status": "ok", "stdout": "869: left, right, _divider = box_segments[0 if first else (1 if last else 2)]\n", "stderr": "", "exit_code": 0} |
| 36 | run_command | {
"command": "python3 -c \"\nfrom rich.table import Table\nfrom rich.box import Box\nfrom rich.console import Console\nfrom io import StringIO\n\nbox_str = (\n 'TLTR\\n' # top\n '1_23\\n' # head: 1=head_left, _=_, 2=head_vertical, 3=head_right\n 'HLHR\\n' # head_row\n '4_56\\n' # mid: 4=mid_left, _=_, 5=mid_vertical, 6=mid_right\n 'RLRR\\n' # row\n 'FLFR\\n' # foot_row\n '7_89\\n' # foot: 7=foot_left, _=_, 8=foot_vertical, 9=foot_right\n 'BLBR' # bottom\n)\n\nbox = Box(box_str)\ntable = Table(box=box, show_header=True, show_footer=True)\ntable.add_column('Date')\ntable.add_column('Title')\ntable.add_row('Dec 20, 2019', 'Star Wars')\ntable.add_row('May 25, 2018', 'Solo')\ntable.add_row('Dec 15, 2017', 'The Last Jedi')\n\nconsole = Console(file=StringIO())\nconsole.print(table)\nprint(console.file.getvalue())\n\""
} | {"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n4 Dec 20, 2019 5 Star Wars 6\n4 May 25, 2018 5full{"status": "ok", "stdout": "TLLLLLLLLLLLLLLTLLLLLLLLLLLLLLLR\n1 Date 2 Title 3\nHLLLLLLLLLLLLLLHLLLLLLLLLLLLLLLR\n4 Dec 20, 2019 5 Star Wars 6\n4 May 25, 2018 5 Solo 6\n4 Dec 15, 2017 5 The Last Jedi 6\nFLLLLLLLLLLLLLLFLLLLLLLLLLLLLLLR\n7 8 9\nBLLLLLLLLLLLLLLBLLLLLLLLLLLLLLLR\n\n", "stderr": "", "exit_code": 0} |
| 37 | run_command | {
"command": "submit_patch"
} | {"status": "error", "error_type": "CommandError", "error_message": "/bin/bash: line 1: submit_patch: command not found\n", "details": {"stdout": "", "stderr": "full{"status": "error", "error_type": "CommandError", "error_message": "/bin/bash: line 1: submit_patch: command not found\n", "details": {"stdout": "", "stderr": "/bin/bash: line 1: submit_patch: command not found\n", "exit_code": 127}} |
| 38 | submit_patch | {} | {"status": "ok", "patch_size": 609, "files_changed": 1}full{"status": "ok", "patch_size": 609, "files_changed": 1} |
diff --git a/rich/table.py b/rich/table.py
index fe4054cf..6268cba4 100644
--- a/rich/table.py
+++ b/rich/table.py
@@ -866,7 +866,7 @@ class Table(JupyterMixin):
_box.get_row(widths, "foot", edge=show_edge), border_style
)
yield new_line
- left, right, _divider = box_segments[0 if first else (2 if last else 1)]
+ left, right, _divider = box_segments[0 if first else (1 if last else 2)]
# If the column divider is whitespace also style it with the row background
divider = (
................... [100%] 19 passed in 0.19s