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

A new state "replace" #8

Closed
jactive opened this issue Nov 4, 2011 · 4 comments
Closed

A new state "replace" #8

jactive opened this issue Nov 4, 2011 · 4 comments

Comments

@jactive
Copy link

jactive commented Nov 4, 2011

This is a feature request rather than a issue. A new state "replace" is require.
See https://github.com/reviewboard/reviewboard/blob/master/reviewboard/diffviewer/myersdiff.py#L123

@kpdecker
Copy link
Owner

kpdecker commented Nov 4, 2011

Could you provide some details on what this would do? I'm not sure how this concept to integrate with unified diffs, etc.

@jactive
Copy link
Author

jactive commented Nov 5, 2011

Thanks for your concern.
The output of jsdiff includes removed, added and unchanged state to describe the kinds of change in the text. For example, original text: aab, new text: aac. In diffChars mode, jsdiff will return [{value: "aa"}, {value: "b", remove: true}, {value: "c", added: true}]. In general purpose, it is good enough. But I want the result to be more useful. I want to know that the b in the original text "aab" is replaced with c in the new text "aac".

If it is not clear enough, the output of myersdiff.py maybe helpful. Take the previous example. The outputs of myersdiff.py are [('equal', 0, 2, 0, 2), ('replace', 2, 3, 2, 3)]. To print this result, please download the python file by the link in my first post. Paste the two line codes below at the bottom of the file myersdiff.py. Please make sure there is no leading space in the two additional line.

differ = MyersDiffer("aab", "aac")
print list(differ.get_opcodes())

@vmariano
Copy link
Contributor

👍
I'm looking for something like that.
A working example of this could be: http://cemerick.github.io/jsdifflib/demo.html

@kpdecker kpdecker closed this as completed May 6, 2015
@giorgio79
Copy link

Wonder why closed? :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants