Skip to content

Commit

Permalink
[path-] fix progress overcount for compressed files
Browse files Browse the repository at this point in the history
  • Loading branch information
midichef committed Mar 3, 2024
1 parent aab3cda commit 338b250
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions visidata/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,9 @@ def _open(self, *args, **kwargs):
return zopen(FileProgress(path, fp=open(path, mode='rb'), **kwargs), **kwargs)

def __iter__(self):
with Progress(total=filesize(self)) as prog:
with self.open(encoding=vd.options.encoding) as fd:
for i, line in enumerate(fd):
prog.addProgress(len(line))
yield line.rstrip('\n')
with self.open(encoding=vd.options.encoding) as fd:
for line in fd:
yield line.rstrip('\n')

def open_bytes(self, mode='rb'):
'Open the file pointed by this path and return a file object in binary mode.'
Expand Down

0 comments on commit 338b250

Please sign in to comment.