8000 OpenEditorAction discards line additions · Issue #316 · coala/coala · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

OpenEditorAction discards line additions #316

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

Closed
AbdealiLoKo opened this issue Feb 22, 2015 · 10 comments · Fixed by #324
Closed

OpenEditorAction discards line additions #316

AbdealiLoKo opened this issue Feb 22, 2015 · 10 comments · Fixed by #324

Comments

@AbdealiLoKo
Copy link
Contributor

I was trying the coala-tutorial, and had some problems when i came across the makefile part :
coala -S Makefiles.bears=LineLengthBear Makefiles.files=Makefile --save

So, coala asked me to edit the file (as expected) and then asked for my editor:

  1. When I put subl for the sublime text editor, it opened a temporary file and it was blank. I had no clue what to do.
  2. When I put vim it opened a temporary file with the content of the Makefile in it. I edited the file by splitting the comment (which was >80 char) into 2 different lines. Saved it, and quit. On checking my Makefile, it seems coala had deleted my second comment and left only the first comment.
@sils
Copy link
Member
sils commented Feb 22, 2015

Hi, the first thing is a known bug, please use subl --waitas command.

@sils
Copy link
Member
sils commented Feb 22, 2015

Editing with vim should work indeed, I'll investigate this further - thanks for the report!

@AbdealiLoKo
Copy link
Contributor Author

So, I used subl --wait and I could open the file successfully.

With subl --wait : I got the same problem as I got in vim. If I split 1
line into 3 lines, it would only save the first line

On Sun, Feb 22, 2015 at 3:52 PM, Lasse Schuirmann notifications@github.com
wrote:

Editing with vim should work indeed, I'll investigate this further -
thanks for the report!

Reply to this email directly or view it on GitHub
#316 (comment)
.

@sils
Copy link
Member
sils commented Feb 22, 2015

Yeah, that's #278 then.

@sils
Copy link
Member
sils commented Feb 22, 2015

I can confirm that the second thing is an issue, sadly.

@sils sils changed the title Issues in coala-tutorial OpenEditorAction discards line additions Feb 23, 2015
@sils
Copy link
Member

Minimal testcase in DiffTest.py:

    def test_from_string_arrays(self):
        a = ["q", "a", "b", "x", "c", "d"]
        b = ["a", "b", "y", "c", "d", "f"]
        self.uut = Diff.from_string_arrays(a, b)
        self.assertEqual(self.uut.apply(a), b)

        a = ["first", "third"]
        b = ["first_changed", "second", "third"]
        self.uut = Diff.from_string_arrays(a, b)
        self.assertEqual(self.uut.apply(a), b)

@sils
Copy link
Member
sils commented Feb 23, 2015

seems to occur when the first line gets changed and a second one gets added.

@sils
Copy link
Member
sils commented Feb 23, 2015

Bug is in Diff.py, from_string_arrays. We do matcher.get_grouped_opcodes(1) and assume that each change group affects only one line in the origin and target file, however it may replace one line with two others in the target group. Other potential bug is addition of several lines and to be tested.

@sils sils self-assigned this Feb 23, 2015
@sils
Copy link
Member
sils commented Feb 23, 2015

or deletion of several lines.

sils added a commit that referenced this issue Feb 23, 2015
We do matcher.get_grouped_opcodes(1) and assume that each change group
affects only one line in the origin and target file. However despit it
may affect only one origin line it may affect several target lines thus
we need to remove that assumption.

Part. fixes: #316
sils added a commit that referenced this issue Feb 23, 2015
sils added a commit that referenced this issue Feb 23, 2015
sils added a commit that referenced this issue Feb 23, 2015
We do matcher.get_grouped_opcodes(1) and assume that each change group
affects only one line in the origin and target file. However despit it
may affect only one origin line it may affect several target lines thus
we need to remove that assumption.

Part. fixes: #316
sils added a commit that referenced this issue Feb 23, 2015
sils added a commit that referenced this issue Feb 23, 2015
sils added a commit that referenced this issue Feb 23, 2015
Previously we assumed that if a line gets changed and the following
lines get deleted, the difflib generates two results for us. This is
wrong and this patch is the correction.

See #316
sils added a commit that referenced this issue Feb 23, 2015
Previously we assumed that if a line gets changed and the following
lines get deleted, the difflib generates two results for us. This is
wrong and this patch is the correction.

See #316
@sils
Copy link
Member
sils commented Feb 23, 2015

I think I've covered all cases now, @AbdealiJK could you do some testing on this branch?

@sils sils closed this as completed Feb 24, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants
0