fix highlighting for selections

This commit is contained in:
2021-12-03 09:03:34 +01:00
parent 6bacfc065b
commit 5b7ebb2f9b
4 changed files with 10 additions and 13 deletions

View File

@@ -87,6 +87,7 @@ class LogFileModel:
offset_in_line = byte_offset - line.byte_offset()
char_index = line.byte_index_to_char_index(offset_in_line)
current_char = line.line()[char_index]
# print("read_word: char_index=%s, current_char=%s, line=%s" %(char_index, current_char, line.line()))
if not self._is_word_char(current_char):
return current_char, byte_offset, byte_offset + 1
start_in_line = line.byte_index_to_char_index(byte_offset - line.byte_offset())
@@ -123,7 +124,8 @@ class LogFileModel:
while l := f.readline():
new_offset = f.tell()
line = Line(offset, new_offset,
l.decode("utf8", errors="ignore").replace("\r", "").replace("\n", ""))
l.decode("utf8", errors="ignore") # .replace("\r", "").replace("\n", "")
)
# print("%s %s %s" %(line.byte_offset(), line.line(), line.byte_end()))
if line.byte_end() <= byte_offset: # line.byte_end() returns the end byte +1
lines_before_offset.append(line)