fix bug with line stream

This commit is contained in:
Maximilian Keßler 2022-02-09 11:26:01 +01:00
parent 410bf3d519
commit 180eae4f12

View file

@ -41,7 +41,7 @@ class LineStream:
self._cached_lines[pos] = line
def reserve_lines(self, num_lines):
for i in range(0, num_lines - len(self._cached_lines) - 1):
for i in range(0, num_lines - len(self._cached_lines)):
self._cached_lines.append(
self._handle.readline()
)
@ -51,7 +51,9 @@ class LineStream:
@property
def exhausted(self) -> bool:
return self._file_exhausted & len(self._cached_lines) == 0
a = self._file_exhausted
b = len(self._cached_lines) == 0
return a & b
class TexFormatter(PyTeXFormatter, ABC):
@ -106,7 +108,7 @@ class TexFormatter(PyTeXFormatter, ABC):
def _shipout_line(self):
line = self.line_stream.pop_line().rstrip()
self.write_line(line)
self.write_line(line + '\n')
def write_line(self, line: str):
if self._output_file is None: