spreadsheet

terminal spreadsheet application
git clone https://git.ce9e.org/spreadsheet.git

commit
a9482827297773669100a931f785dbb2f6f2b2c0
parent
864914d7aa02b1ac360dfc58fa39fc9c0eacf39c
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2024-07-05 18:31
fix line length calculation

Diffstat

M sheet/__main__.py 14 ++++++++++----

1 files changed, 10 insertions, 4 deletions


diff --git a/sheet/__main__.py b/sheet/__main__.py

@@ -57,7 +57,11 @@ class App(boon.App):
   57    57 
   58    58         lines.append(' ' * 4)
   59    59         x = self.x0
   60    -1         while len(lines[-1]) < cols:
   -1    60         width = 4
   -1    61         while True:
   -1    62             width += self.get_width(x)
   -1    63             if width > cols:
   -1    64                 break
   61    65             row_head = align_center(x2col(x), self.get_width(x))
   62    66             if x == self.cursor_x:
   63    67                 row_head = invert(row_head)
@@ -73,9 +77,11 @@ class App(boon.App):
   73    77             lines.append(col_head)
   74    78 
   75    79             x = self.x0
   76    -1             # FIXME: do not count ANSI codes for length
   77    -1             # FIXME; lines are longer than they should be (we stop once we are >=)
   78    -1             while len(lines[-1]) < cols:
   -1    80             width = 4
   -1    81             while True:
   -1    82                 width += self.get_width(x)
   -1    83                 if width > cols:
   -1    84                     break
   79    85                 value = self.sheet.get_value((x, y))
   80    86                 cell = to_cell(value, self.get_width(x))
   81    87                 if x == self.cursor_x and y == self.cursor_y: