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

Already on GitHub? Sign in to your account

Cannot show diff in the current document #33

Xaapyks opened this Issue Jan 9, 2013 · 7 comments


None yet
2 participants

Xaapyks commented Jan 9, 2013

I happen to work on a svn working copy with lots of new files added (A) and most of them can't show the diff in ST2, console view shows me :

Traceback (most recent call last):
File ".\Modific.py", line 391, in diff_done
File ".\Modific.py", line 314, in get_lines_to_hl
File ".\Modific.py", line 293, in get_chunks
IndexError: string index out of range

I also seems that it may been due to some property changes in the diff, the few files that work and show the diff have no property change, whereas the ones I see failing have:

Property changes on: src/xxxxx.cpp

Added: svn:eol-style
## -0,0 +1 ##
\ No newline at end of property

Xaapyks commented Jan 9, 2013

OK I just found what the problem is, it happens when the diff somehow has empty lines, probably because of the last part about properties.

Youi just need to replace occurences of "if line[0]" with "if line and line[0]"


gornostal commented Jan 9, 2013

Thank you for the solution. I will add it to the code ASAP.

gornostal pushed a commit that referenced this issue Jan 12, 2013


gornostal commented Jan 12, 2013

I could not reproduce this issue, but I made fix for it as you proposed.
Let me know if plugin works now.

Xaapyks commented Jan 12, 2013

Thanks, I'll let you know when I get back to office.
Though I remembver I had to change 2 occurences to fix it, and once more to completely get rid of stack traces.

If it does not fix, I'll send you a patch.
Thanks anyways.

Xaapyks commented Jan 14, 2013

Tested from office, I still have a backtrace and it fails.
So here is a patch :

--- Modific.py.orig  2013-01-14 11:12:13.000000000 +0100
+++ Modific.py 2013-01-14 11:14:16.000000000 +0100
@@ -312,17 +312,17 @@
         deleted = []

         for chunk in self.get_chunks():
             current = chunk['start']
             deleted_line = None
             for line in chunk['lines']:
-                if line[0] == '-':
+                if line.startswith('-'):
                     if (not deleted_line or deleted_line not in deleted):
                     deleted_line = current
-                elif line[0] == '+':
+                elif line.startswith('+'):
                     if deleted_line:
                         deleted_line = None
                     elif current - 1 in changed:

Sorry for not bothering to fork and do a pull request, I'm at work and lacking time + git tools...

gornostal pushed a commit that referenced this issue Jan 16, 2013


gornostal commented Jan 16, 2013

Thanks. I should have been using startswith instead of line[0]


gornostal commented Jan 16, 2013

Please, feel free to reopen this issue, if it still occurs.

@gornostal gornostal closed this Jan 16, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment