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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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):
+6 −0
Original line number Diff line number Diff line
@@ -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'''