improve highlighting

This commit is contained in:
2021-10-24 18:49:47 +02:00
parent 80741a7249
commit eab422a6ce
7 changed files with 121 additions and 14 deletions

View File

@@ -2,6 +2,8 @@ from typing import List
import os
from line import Line
from settings import Settings
class LogFileModel:
def __init__(self, file):
@@ -12,8 +14,8 @@ class LogFileModel:
# TODO handle lines longer than 4096 bytes
with open(self._file, 'r') as f:
offset = max(0, byte_offset - 4096)
offset = offset - offset % 4096 # align to blocks of 4kb
offset = max(0, byte_offset - Settings.max_line_length())
offset = offset - offset % Settings.max_line_length() # align to blocks of 4kb
f.seek(offset)
while l := f.readline():
new_offset = f.tell()