Skip to content
Snippets Groups Projects
Commit 6c7b043f authored by Seblu's avatar Seblu
Browse files

Add clear function to the Printer

clearing terminal is now a function of class  Printer.
Command clear, now use it.
parent f3845fec
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,7 @@ class Command_clear(Command):
def __call__(self, argv):
if len(argv) != 1:
raise cmdBadArgument()
self.printer.out("\033[H\033[2J", nl="")
self.printer.clear()
class Command_help(Command):
......
......@@ -170,6 +170,12 @@ class Printer(object):
rows, cols, px_x, px_y = struct.unpack("HHHH", resp)
return rows, cols
def clear(self):
'''Clear the terminal'''
if self.readline is None or not sys.stdout.isatty():
return
self.out("\033[H\033[2J", nl="")
class History(object):
'''History class'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment