fix crash when double clicking behind the last char

This commit is contained in:
2021-11-26 18:43:12 +01:00
parent 0e27cb2b26
commit b3e5d535b7
2 changed files with 3 additions and 4 deletions

View File

@@ -81,12 +81,11 @@ class LogFileModel:
if len(lines) == 0:
return "", -1, -1
line: Line = lines[0]
if not lines[0].includes_byte(byte_offset):
if not line.includes_byte(byte_offset):
return "", -1, -1
offset_in_line = byte_offset - line.byte_offset()
char_index = line.byte_index_to_char_index(offset_in_line)
# todo char_index may be out of range
current_char = line.line()[char_index]
if not self._is_word_char(current_char):
return current_char, byte_offset, byte_offset + 1