terminalwriter: remove unused function TerminalWriter.reline

This commit is contained in:
Ran Benita 2020-04-29 16:15:23 +03:00
parent a6819726cd
commit 0528307ebf
1 changed files with 0 additions and 22 deletions

View File

@ -96,7 +96,6 @@ class TerminalWriter:
self.encoding = encoding or getattr(file, "encoding", "utf-8") self.encoding = encoding or getattr(file, "encoding", "utf-8")
self._file = file self._file = file
self.hasmarkup = should_do_markup(file) self.hasmarkup = should_do_markup(file)
self._lastlen = 0
self._chars_on_current_line = 0 self._chars_on_current_line = 0
self._width_of_current_line = 0 self._width_of_current_line = 0
@ -114,11 +113,6 @@ class TerminalWriter:
def chars_on_current_line(self): def chars_on_current_line(self):
"""Return the number of characters written so far in the current line. """Return the number of characters written so far in the current line.
Please note that this count does not produce correct results after a reline() call,
see #164.
.. versionadded:: 1.5.0
:rtype: int :rtype: int
""" """
return self._chars_on_current_line return self._chars_on_current_line
@ -127,8 +121,6 @@ class TerminalWriter:
def width_of_current_line(self): def width_of_current_line(self):
"""Return an estimate of the width so far in the current line. """Return an estimate of the width so far in the current line.
.. versionadded:: 1.6.0
:rtype: int :rtype: int
""" """
return self._width_of_current_line return self._width_of_current_line
@ -200,22 +192,8 @@ class TerminalWriter:
def line(self, s: str = "", **kw): def line(self, s: str = "", **kw):
self.write(s, **kw) self.write(s, **kw)
self._checkfill(s)
self.write("\n") self.write("\n")
def reline(self, line: str, **kw):
if not self.hasmarkup:
raise ValueError("cannot use rewrite-line without terminal")
self.write(line, **kw)
self._checkfill(line)
self.write("\r")
self._lastlen = len(line)
def _checkfill(self, line: str) -> None:
diff2last = self._lastlen - len(line)
if diff2last > 0:
self.write(" " * diff2last)
class WriteFile: class WriteFile:
def __init__(self, writemethod, encoding=None): def __init__(self, writemethod, encoding=None):