the same line cache was used for the file view and the filter view
This commit is contained in:
@@ -22,8 +22,6 @@ class LogFileModel:
|
||||
range_start = 0
|
||||
range_end = -1
|
||||
|
||||
_line_cache = {}
|
||||
|
||||
def __init__(self, file: str, settings: Settings, original_file: str = False):
|
||||
"""
|
||||
:param file:
|
||||
@@ -34,6 +32,7 @@ class LogFileModel:
|
||||
self._file = os.path.realpath(file)
|
||||
self._original_file = os.path.realpath(original_file) if original_file else self._file
|
||||
self._file_name = os.path.basename(self._original_file)
|
||||
self._line_cache = {}
|
||||
|
||||
def highlighters(self):
|
||||
all_highlighters = Highlighting.read_config(self.settings)
|
||||
@@ -137,6 +136,7 @@ class LogFileModel:
|
||||
return re.match(r"\w", char) is not None
|
||||
|
||||
def prune_cache(self, range_start: int, range_end: int):
|
||||
print(f"cache size: {len(self._line_cache.keys())}")
|
||||
for key in list(self._line_cache.keys()):
|
||||
line = self._line_cache[key]
|
||||
if range_start > line.byte_end() or line.byte_offset() > range_end:
|
||||
|
||||
Reference in New Issue
Block a user