Save full summary on quit regardless of cursor row

__getstate__ emitted an empty entry list whenever the cursor was on the
top row (y == 0), so quitting from the top silently discarded all
previously calculated results. The guard was intended to rotate the
cursor row to the front, but the y == 0 case should simply keep the whole
list as-is. Remove the guard so all entries are always persisted.
This commit is contained in:
Andrew Hamilton 2026-08-03 12:45:59 +10:00
parent 53474b2bcb
commit 8af627b502
2 changed files with 7 additions and 1 deletions

View file

@ -101,6 +101,12 @@ class SummaryCursorTest(unittest.TestCase):
self._assert_movements([(self.summary.cursor_down, (1, 1)),
(self.summary.cursor_down, (2, 2))])
def test_getstate_preserves_entries_at_top_row(self):
state = self.summary.__getstate__()
entries = list(state["_old_entries"])
self.assertEqual(len(entries), 3)
self.assertEqual(sum(len(row) for row in entries), 8)
class SummarySyncWithFilesystemTestCase(unittest.TestCase):