diff --git a/rtv/page.py b/rtv/page.py index d71e597..2235604 100644 --- a/rtv/page.py +++ b/rtv/page.py @@ -397,7 +397,10 @@ class Page(object): # tmux) but many people override ther $TERM in their tmux.conf or # .bashrc file. Using clearok() instead seems to fix the problem, at # 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() def _draw_header(self): diff --git a/rtv/terminal.py b/rtv/terminal.py index 401f942..df1a4c4 100644 --- a/rtv/terminal.py +++ b/rtv/terminal.py @@ -769,3 +769,11 @@ class Terminal(object): out = '\n'.join(stack) 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) + \ No newline at end of file