fix for only drawing one effected line and only draw effected lines on marking

This commit is contained in:
Nick 2011-02-02 12:50:40 +01:00
parent eba7c2bf17
commit 5dcc935852
2 changed files with 6 additions and 3 deletions

View File

@ -503,6 +503,7 @@ class AllTorrents(BaseMode):
attr = None attr = None
if lines: if lines:
tidx = lines.pop()+1 tidx = lines.pop()+1
currow = tidx-self.curoff+2
if tidx in self.marked: if tidx in self.marked:
bg = "blue" bg = "blue"
@ -532,9 +533,6 @@ class AllTorrents(BaseMode):
else: else:
colorstr = "{!%s,%s!}"%(fg,bg) colorstr = "{!%s,%s!}"%(fg,bg)
if lines:
currow = tidx-self.curoff+2
self.add_string(currow,"%s%s"%(colorstr,row[0])) self.add_string(currow,"%s%s"%(colorstr,row[0]))
tidx += 1 tidx += 1
currow += 1 currow += 1
@ -636,11 +634,14 @@ class AllTorrents(BaseMode):
self.updater.set_torrent_to_update(cid,self._status_keys) self.updater.set_torrent_to_update(cid,self._status_keys)
elif chr(c) == 'm': elif chr(c) == 'm':
self._mark_unmark(self.cursel) self._mark_unmark(self.cursel)
effected_lines = [self.cursel-1]
elif chr(c) == 'M': elif chr(c) == 'M':
if self.last_mark >= 0: if self.last_mark >= 0:
self.marked.extend(range(self.last_mark,self.cursel+1)) self.marked.extend(range(self.last_mark,self.cursel+1))
effected_lines = range(self.last_mark,self.cursel)
else: else:
self._mark_unmark(self.cursel) self._mark_unmark(self.cursel)
effected_lines = [self.cursel-1]
elif chr(c) == 'c': elif chr(c) == 'c':
self.marked = [] self.marked = []
self.last_mark = -1 self.last_mark = -1

View File

@ -96,6 +96,8 @@ class TorrentDetail(BaseMode, component.Component):
self.column_string = "" self.column_string = ""
self.marked = {}
BaseMode.__init__(self, stdscr, encoding) BaseMode.__init__(self, stdscr, encoding)
component.Component.__init__(self, "TorrentDetail", 1, depend=["SessionProxy"]) component.Component.__init__(self, "TorrentDetail", 1, depend=["SessionProxy"])