Skip to content

Commit

Permalink
[sort-] do not modify Sheet._ordering #2254
Browse files Browse the repository at this point in the history
Every sheet instance needs its own _ordering list, which orderBy modifies.
But _ordering is defined at the class level so it can be easily specified per class.
Now we make a copy of the class _ordering when a new sheet is instantiated, so that orderBy doesn't modify the class list.
  • Loading branch information
saulpw committed Jan 15, 2024
1 parent bee81a0 commit 6424f63
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions visidata/sheets.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ def __init__(self, *names, rows=UNLOADED, **kwargs):
self.initialCols = kwargs.pop('columns', None) or type(self).columns
self.resetCols()

self._ordering = list(type(self)._ordering) #2254
self._colorizers = self.classColorizers
self.recalc() # set .sheet on columns and start caches

Expand Down

0 comments on commit 6424f63

Please sign in to comment.