equal
deleted
inserted
replaced
2503 for chunk in func(*args, **kw): |
2503 for chunk in func(*args, **kw): |
2504 lines = chunk.split('\n') |
2504 lines = chunk.split('\n') |
2505 matches = {} |
2505 matches = {} |
2506 if inlinecolor: |
2506 if inlinecolor: |
2507 matches = _findmatches(lines) |
2507 matches = _findmatches(lines) |
|
2508 linecount = len(lines) |
2508 for i, line in enumerate(lines): |
2509 for i, line in enumerate(lines): |
2509 if i != 0: |
|
2510 yield ('\n', '') |
|
2511 if head: |
2510 if head: |
2512 if line.startswith('@'): |
2511 if line.startswith('@'): |
2513 head = False |
2512 head = False |
2514 else: |
2513 else: |
2515 if line and not line.startswith((' ', '+', '-', '@', '\\')): |
2514 if line and not line.startswith((' ', '+', '-', '@', '\\')): |
2544 break |
2543 break |
2545 else: |
2544 else: |
2546 yield (line, '') |
2545 yield (line, '') |
2547 if line != stripline: |
2546 if line != stripline: |
2548 yield (line[len(stripline):], 'diff.trailingwhitespace') |
2547 yield (line[len(stripline):], 'diff.trailingwhitespace') |
|
2548 if i + 1 < linecount: |
|
2549 yield ('\n', '') |
2549 |
2550 |
2550 def _findmatches(slist): |
2551 def _findmatches(slist): |
2551 '''Look for insertion matches to deletion and returns a dict of |
2552 '''Look for insertion matches to deletion and returns a dict of |
2552 correspondences. |
2553 correspondences. |
2553 ''' |
2554 ''' |