partially fix scrolling in files > 2 GB
This commit is contained in:
@@ -57,7 +57,7 @@ class LogFileModel:
|
||||
return bytes.decode("utf8", errors="ignore")
|
||||
|
||||
def write_range(self, start_byte: int, end_byte: int, file: str):
|
||||
print("write range: %d - %d -> %s" % (start_byte, end_byte, file))
|
||||
# print("write range: %d - %d -> %s" % (start_byte, end_byte, file))
|
||||
with self._lock, open(self._file, 'rb') as source, open(file, "w+b") as target:
|
||||
offset = start_byte
|
||||
source.seek(offset)
|
||||
@@ -82,10 +82,9 @@ class LogFileModel:
|
||||
# TODO abort file open after a few secons: https://docs.python.org/3/library/signal.html#example
|
||||
with open(self._file, 'rb') as f:
|
||||
offset = min(byte_offset, self.byte_count())
|
||||
#print("offset: %s byte_count: %d" % (offset, self.byte_count()))
|
||||
offset = max(0, offset - self.settings.max_line_length())
|
||||
|
||||
# print("offset: %s" % (offset))
|
||||
|
||||
eof_reached = True
|
||||
f.seek(offset)
|
||||
while l := f.readline():
|
||||
|
||||
Reference in New Issue
Block a user