copy to clipboard for ascii text

Non ascii does not work yet. Code does not handle multi-byte characters.
This commit is contained in:
2021-10-25 17:19:44 +02:00
parent 9334fffb6f
commit 76d4dccf1d
2 changed files with 28 additions and 9 deletions

View File

@@ -12,6 +12,13 @@ class LogFileModel:
def __init__(self, file):
self._file = file
def read_range(self, start_byte: int, end_byte: int):
with self._lock:
with open(self._file, 'rb') as f:
f.seek(start_byte)
bytes = f.read(end_byte - start_byte)
return bytes.decode("utf8", errors="ignore")
def data(self, byte_offset, scroll_lines, lines) -> List[Line]:
#print("data(%s, %s, %s)" % (byte_offset, scroll_lines, lines))
lines_before_offset: List[Line] = []