MCPcopy
hub / github.com/jisaacks/GitGutter / _highlight_diff

Function _highlight_diff

modules/popup/differ.py:17–34  ·  view source on GitHub ↗
(a, b)

Source from the content-addressed store, hash-verified

15
16
17def _highlight_diff(a, b):
18 # begin of mdpopups code view
19 yield '<div class="highlight">'
20 cruncher = difflib.SequenceMatcher(None, a, b, False)
21 for tag, alo, ahi, blo, bhi in cruncher.get_opcodes():
22 if tag == 'replace':
23 g = _fancy_replace(a, alo, ahi, b, blo, bhi)
24 elif tag == 'delete':
25 g = _dump_lines('del', a, alo, ahi)
26 elif tag == 'insert':
27 g = _dump_lines('ins', b, blo, bhi)
28 elif tag == 'equal':
29 g = _dump_lines(None, a, alo, ahi)
30 else:
31 raise ValueError('unknown tag {0}'.format(tag))
32 yield from g
33 # end of mdpopups code view
34 yield '</div>'
35
36
37def _plain_replace(a, alo, ahi, b, blo, bhi):

Callers 1

highlight_diffFunction · 0.85

Calls 2

_fancy_replaceFunction · 0.85
_dump_linesFunction · 0.85

Tested by

no test coverage detected