Issue #343 Added method to clear screen
This commit is contained in:
@@ -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):
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|
||||||
Reference in New Issue
Block a user