self._main_menu = None
self._main_menu_pad = None
+ def _pad_line_end_with_whitespace(self, pad, row, line_end_x):
+ """Pad the whitespace at the end of a line with the default color pair.
+
+ Prevents spurious color pairs from appearing at the end of the lines in
+ certain text terimnals.
+
+ Args:
+ pad: The curses pad object to operate on.
+ row: (`int`) row index.
+ line_end_x: (`int`) column index of the end of the line (beginning of
+ the whitespace).
+ """
+ if line_end_x < self._max_x - 2:
+ pad.addstr(row, line_end_x, " " * (self._max_x - 3 - line_end_x),
+ self._default_color_pair)
+
def _screen_add_line_to_output_pad(self, pad, row, txt, color_segments=None):
"""Render a line in a text pad.
if not color_segments:
pad.addstr(row, 0, txt, self._default_color_pair)
+ self._pad_line_end_with_whitespace(pad, row, len(txt))
return
if not isinstance(color_segments, list):
for segment, color_pair in zip(all_segments, all_color_pairs):
if segment[1] < self._max_x:
pad.addstr(row, segment[0], txt[segment[0]:segment[1]], color_pair)
+ if all_segments:
+ self._pad_line_end_with_whitespace(pad, row, all_segments[-1][1])
def _screen_scroll_output_pad(self, pad, viewport_top, viewport_left,
screen_location_top, screen_location_left,