fix bug with line stream
This commit is contained in:
parent
410bf3d519
commit
180eae4f12
1 changed files with 5 additions and 3 deletions
|
@ -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:
|
||||
|
|
Loading…
Reference in a new issue