From e6d18352c5874364a7bbb65ad41a198838d907ed Mon Sep 17 00:00:00 2001 From: Owen Cochell Date: Fri, 4 Apr 2025 14:26:08 -0400 Subject: [PATCH] misc: fix empty character sheet on Linux --- pqcli/ui/curses/widgets/data_table.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pqcli/ui/curses/widgets/data_table.py b/pqcli/ui/curses/widgets/data_table.py index 9657bb2..65aa0df 100644 --- a/pqcli/ui/curses/widgets/data_table.py +++ b/pqcli/ui/curses/widgets/data_table.py @@ -69,10 +69,11 @@ class DataTable(Scrollable): if y == self._selected and has_colors(): self._pad.attron(curses.color_pair(COLOR_HIGHLIGHT)) self._pad.addnstr(y, 0, row[0], min(len(row[0]), w)) - if col2_x < w: - self._pad.addnstr( - y, col2_x, row[1], min(len(row[1]), w - col2_x) - ) + # Determine the number of characters to write + nwrite = min(len(row[1]), w - col2_x) + # Ensure we have enough columns, and we are writing more than zero + if col2_x < w and nwrite > 0: + self._pad.addnstr(y, col2_x, row[1], nwrite) if y == self._selected and has_colors(): self._pad.attroff(curses.color_pair(COLOR_HIGHLIGHT))