def add(self):
self.numbers.append(urwid.Text(str(len(self.numbers)+1) + '| ', align='right'))
if len(str(len(self.numbers)-1)) > self.width:
self.width += 1
new_col = urwid.Columns([(self.width+2, self.display.line_nums), self.display.listbox], focus_column=1)
self.display.top.contents['body'] = (new_col, None)
# this method simply deletes a line from the end of the line numbers
# note: we have to check that we didnt delete the last line or we get an index out of bounds!
评论列表
文章目录