def delete_lines(self, count=None):
"""Deletes the indicated # of lines, starting at line with
cursor. As lines are deleted, lines displayed below cursor
move up. Lines added to bottom of screen have spaces with same
character attributes as last line moved up.
:param int count: number of lines to delete.
"""
count = count or 1
top, bottom = self.margins
# If cursor is outside scrolling margins it -- do nothin'.
if top <= self.cursor.y <= bottom:
# v -- +1 to include the bottom margin.
for _ in range(min(bottom - self.cursor.y + 1, count)):
self.buffer.pop(self.cursor.y)
self.buffer.insert(bottom, list(
repeat(self.cursor.attrs, self.columns)))
self.carriage_return()
评论列表
文章目录