Fix incorrect remapping of line numbers on resize

This commit is contained in:
Kovid Goyal 2014-01-30 10:30:10 +05:30
parent 12b93c5bf0
commit 3c50a45ad6

View File

@ -631,9 +631,11 @@ class DiffSplit(QSplitter): # {{{
v.images[top] = (img, w, lines) v.images[top] = (img, w, lines)
def mapnum(x): def mapnum(x):
return x if x <= top else x + delta return x if x <= top else x + delta
lnm = v.line_number_map lnm = LineNumberMap()
for x, val in tuple(lnm.iteritems()): lnm.max_width = v.line_number_map.max_width
for x, val in v.line_number_map.iteritems():
dict.__setitem__(lnm, mapnum(x), val) dict.__setitem__(lnm, mapnum(x), val)
v.line_number_map = lnm
v.changes = [(mapnum(t), mapnum(b), kind) for t, b, kind in v.changes] v.changes = [(mapnum(t), mapnum(b), kind) for t, b, kind in v.changes]
v.headers = [(mapnum(x), name) for x, name in v.headers] v.headers = [(mapnum(x), name) for x, name in v.headers]
v.images = OrderedDict((mapnum(x), v) for x, v in v.images.iteritems()) v.images = OrderedDict((mapnum(x), v) for x, v in v.images.iteritems())