Commit 686aac87 authored by Kai Willadsen's avatar Kai Willadsen

Remove unused change range arguments and cleanup appropriately

FileDiff._update_highlighting() has unused arguments, making the return
values for Differ.change_sequence() and Differ._change_sequence() also
unused. This commit removes all of these, plus the unused
all_changes_in_range() method from Differ.
parent 111a5dd4
......@@ -69,16 +69,14 @@ class Differ(object):
def change_sequence(self, sequence, startidx, sizechange, texts):
assert sequence in (0,1,2)
changes = [[0,0],[0,0]]
if sequence != 1: #0 or 2
which = sequence / 2
changes[which] = self._change_sequence(which, sequence, startidx, sizechange, texts)
self._change_sequence(which, sequence, startidx, sizechange, texts)
else: # sequence==1:
changes[0] = self._change_sequence( 0, sequence, startidx, sizechange, texts)
self._change_sequence(0, sequence, startidx, sizechange, texts)
if self.num_sequences == 3:
changes[1] = self._change_sequence( 1, sequence, startidx, sizechange, texts)
self._change_sequence(1, sequence, startidx, sizechange, texts)
self.seqlength[sequence] += sizechange
return changes
def _locate_chunk(self, whichdiffs, sequence, line):
"""Find the index of the chunk which contains line."""
......@@ -127,7 +125,6 @@ class Differ(object):
c[3] + lines_added[x], c[4] + lines_added[x])
for c in self.diffs[which][hiidx:] ]
self.diffs[which][loidx:hiidx] = newdiffs
return loidx,hiidx
def reverse(self, c):
return self.reversemap[c[0]], c[3],c[4], c[1],c[2]
......@@ -136,10 +133,6 @@ class Differ(object):
for c in self._merge_diffs(self.diffs[0], self.diffs[1], texts):
yield c
def all_changes_in_range(self, texts, l0, h0, l1, h1):
for c in self._merge_diffs(self.diffs[0][l0:h0], self.diffs[1][l0:h0], texts):
yield c
def pair_changes(self, fromindex, toindex, texts):
"""Give all changes between file1 and either file0 or file2.
......@@ -195,8 +195,8 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
def _after_text_modified(self, buffer, startline, sizechange):
if self.num_panes > 1:
pane = self.textbuffer.index(buffer)
change_range = self.linediffer.change_sequence( pane, startline, sizechange, self._get_texts())
for it in self._update_highlighting( change_range[0], change_range[1] ):
self.linediffer.change_sequence(pane, startline, sizechange, self._get_texts())
for it in self._update_highlighting():
......@@ -595,8 +595,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
yield 1
self.scheduler.add_task( lambda: self.next_diff(gdk.SCROLL_DOWN, jump_to_first=True), True )
lenseq = [len(d) for d in self.linediffer.diffs]
self.scheduler.add_task( self._update_highlighting( (0,lenseq[0]), (0,lenseq[1]) ).next )
if srcviewer:
for i in range(len(files)):
......@@ -604,7 +603,7 @@ class FileDiff(melddoc.MeldDoc, gnomeglade.Component):
srcviewer.set_highlighting_enabled_from_file(self.textbuffer[i], files[i], self.prefs.use_syntax_highlighting)
yield 0
def _update_highlighting(self, range0, range1):
def _update_highlighting(self):
for b in self.textbuffer:
taglist = ["delete line", "conflict line", "replace line", "inline line"]
table = b.get_tag_table()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment