Use clrtoeol to draw blank lines

This commit is contained in:
Anthony Sottile
2020-03-13 19:10:23 -07:00
parent 59946cad9a
commit b52fb15368
2 changed files with 12 additions and 8 deletions

View File

@@ -811,9 +811,9 @@ class File:
x = self.x if line_idx == self.y else 0
line = scrolled_line(line, x, curses.COLS)
stdscr.insstr(i + margin.header, 0, line)
blankline = ' ' * curses.COLS
for i in range(to_display, margin.body_lines):
stdscr.insstr(i + margin.header, 0, blankline)
stdscr.move(i + margin.header, 0)
stdscr.clrtoeol()
if self.select_start is not None:
(s_y, s_x), (e_y, e_x) = self._get_selection()

View File

@@ -148,21 +148,25 @@ class CursesScreen:
def keypad(self, val):
pass
def nodelay(self, val):
self._runner.screen.nodelay = val
def insstr(self, y, x, s, attr=0):
self._runner.screen.insstr(y, x, s)
def clrtoeol(self):
s = self._runner.screen.width * ' '
self.insstr(self._runner.screen.y, self._runner.screen.x, s)
def chgat(self, y, x, n, color):
pass
def move(self, y, x):
self._runner.screen.move(y, x)
def get_wch(self):
return self._runner._get_wch()
def chgat(self, y, x, n, color):
pass
def nodelay(self, val):
self._runner.screen.nodelay = val
class Key(NamedTuple):
tmux: str