Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix bug in diff generator #33

Merged
merged 1 commit into from
Oct 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,9 @@ def _dump(self, tag, x, lo, hi):
"""Generate comparison results for a same-tagged range."""
for i in range(lo, hi):
if tag == '-':
yield '%s [red] %s [/red] ' % (tag, x[i])
yield '%s [red] %s [/red]' % (tag, x[i])
elif tag == '+':
yield '%s [green] %s [/green] ' % (tag, x[i])
yield '%s [green] %s [/green]' % (tag, x[i])
else:
yield '%s %s' % (tag, x[i])

Expand Down Expand Up @@ -322,17 +322,10 @@ def reformat(tags, line):
for i in range(0, len(tags)):
if tags[i] == "^":
temp_line += "[yellow bold underline]" + line[i] + "[/yellow bold underline]"
continue
elif tags[i] == "+":
temp_line += line[i]
continue
elif tags[i] == "-":
else:
temp_line += line[i]
continue

temp_line += line[i]

temp_line += line[-(len(line) - len(tags)):]
temp_line += line[len(tags):]
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main change is this line.

Other changes are minor refactors.

return temp_line

def _keep_original_ws(s, tag_s):
Expand Down