scroll with scrollbars

This commit is contained in:
2021-10-25 09:32:18 +02:00
parent 7f376fe8a8
commit 905fe355e5
4 changed files with 77 additions and 12 deletions

View File

@@ -31,7 +31,7 @@ class LogFileModel:
f.seek(offset)
while l := f.readline():
new_offset = f.tell()
line = Line(offset, new_offset, l.decode("utf8").replace("\r", "").replace("\n", ""))
line = Line(offset, new_offset, l.decode("utf8", errors="ignore").replace("\r", "").replace("\n", ""))
# print("%s %s" %(line.byte_offset(), line.line()))
if offset < byte_offset:
lines_before_offset.append(line)
@@ -48,7 +48,7 @@ class LogFileModel:
elif eof_reached:
# we always return the number of requested lines even if we reach the end of the file
lines_to_return_from_before_offset = int(lines_to_find - len(lines_after_offset));
print(lines_to_return_from_before_offset)
#print(lines_to_return_from_before_offset)
if lines_to_return_from_before_offset > 0:
result = result + lines_before_offset[-lines_to_return_from_before_offset:]
result = result + lines_after_offset