Issue #343 Added method to clear screen

This commit is contained in:
Ryan Reno
2017-06-20 21:07:24 -07:00
parent 752e63a509
commit 370cfa0642
2 changed files with 12 additions and 1 deletions

View File

@@ -397,7 +397,10 @@ class Page(object):
# tmux) but many people override ther $TERM in their tmux.conf or # tmux) but many people override ther $TERM in their tmux.conf or
# .bashrc file. Using clearok() instead seems to fix the problem, at # .bashrc file. Using clearok() instead seems to fix the problem, at
# the expense of slightly more expensive screen refreshes. # the expense of slightly more expensive screen refreshes.
self.term.stdscr.clearok(True) # However clearok() introduced a screen flash bug to urxvt users so the
# clear_screen() method chooses which of the two stdscr methods to use
# based on the $TERM environment variable
self.term.clear_screen()
self.term.stdscr.refresh() self.term.stdscr.refresh()
def _draw_header(self): def _draw_header(self):

View File

@@ -769,3 +769,11 @@ class Terminal(object):
out = '\n'.join(stack) out = '\n'.join(stack)
return out return out
# Resolves tmux touchwin() bug and urxvt clearok() flashing bug
def clear_screen(self):
if os.environ['TERM'] is not 'xterm-256color':
self.stdscr.touchwin()
else:
self.stdscr.clearok(True)