-
Notifications
You must be signed in to change notification settings - Fork 618
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
diff parsing, regardless of diff-prefix choices #1337
base: master
Are you sure you want to change the base?
Conversation
naive fix#1336
src/diff.c
Outdated
break; | ||
if (!prefixcmp(data, "--- ")) { | ||
const char *data_n1 = box_text(diff+1); | ||
const char *data_n2 = box_text(diff+2); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably needs a bounds check here
Confess I only went for a patch because it would get the 1337 id... Looking the code just around the error message, I already had all the context to send in a fix in a language i haven't touched in over 15years. The text area here was enough "IDE support". I'm aware this is not "done" code, but was enough to downloaded my branch, build, and get the feature i needed without considering edge cases. Haven't looked at the failing test yet 🙄 Well, just meant this as an appreciation note. Thank you. Had used tig for years, but never had a reason to look at the nice source, which is another compliment I guess. cheers. |
7h4nk5 for reporting and trying to fix the issue. Test case is failing because your fix breaks the original prefixed use case. |
Thanks for pointing out the test issue! will try to polish this when i get some down time next month, if nobody beat me to it. |
src/diff.c
Outdated
const char *data_n1 = box_text(diff+1); | ||
const char *data_n2 = box_text(diff+2); | ||
if(!prefixcmp(data_n1, "+++ ") && !prefixcmp(data_n2, "@@ ")){ | ||
file = data + STRING_SIZE("--- "); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all these hardcoded strings can probably be from https://github.com/jonas/tig/blob/master/include/tig/line.h#L29
also needs to account for |
handle all diff view options (noprefix, mnemonicPrefix, srcPrefix, dstPrefix, line-prefix)
(moved quick fix of #1336 to #1338)