From f6e7f2ff09cc14bb2572204a0dcb351e36ef1365 Mon Sep 17 00:00:00 2001 From: Andrew Kay Date: Wed, 26 Jun 2019 19:34:57 -0500 Subject: [PATCH] Fix issue where entire screen was cleared by VT100 session erasing status line set by controller --- oec/controller.py | 2 +- oec/display.py | 13 ++++++++++--- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/oec/controller.py b/oec/controller.py index 211f26c..a8585ab 100644 --- a/oec/controller.py +++ b/oec/controller.py @@ -80,7 +80,7 @@ class Controller: self.logger.info(f'Rows = {rows}, Columns = {columns}, Keymap = {keymap_name}') - self.terminal.display.clear_screen() + self.terminal.display.clear_screen(include_status_line=True) # Show the attached indicator on the status line. self.terminal.display.status_line.write_string(0, 'S') diff --git a/oec/display.py b/oec/display.py index 9fd307b..b2b46d6 100644 --- a/oec/display.py +++ b/oec/display.py @@ -179,11 +179,18 @@ class Display: self.address_counter = address - def clear_screen(self): - """Clear the screen - including the status line.""" + def clear_screen(self, include_status_line=False): + """Clear the screen.""" (rows, columns) = self.dimensions - self.interface.offload_write(b'\x00', address=0, repeat=((rows+1)*columns)-1) + if include_status_line: + address = 0 + repeat = ((rows + 1) * columns) - 1 + else: + address = columns + repeat = (rows * columns) - 1 + + self.interface.offload_write(b'\x00', address=address, repeat=repeat) # Update the buffer and dirty indicators to reflect the cleared screen. for index in range(rows * columns):