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

Code comments don't work when changing the number of lines #67

Open
alexkiro opened this issue Mar 11, 2016 · 3 comments · May be fixed by #71
Open

Code comments don't work when changing the number of lines #67

alexkiro opened this issue Mar 11, 2016 · 3 comments · May be fixed by #71

Comments

@alexkiro
Copy link

When changing the number of lines shown in a diff the code comments fail to work correctly unless they are viewed at the same line.

Steps:

  1. Choose a commit
  2. Change the "number of lines around each change"
  3. Leave a comment
  4. Change the "number of lines around each change" back to 2
  5. See that the comment will either be displayed in the wrong position, or not at all.
@SebDieBln
Copy link

I can confirm this bug. It seems like a design flaw or like CodeCommentsPlugin has been designed before Trac was able to adjust the size of the context. The line number the comment is linked to refers to a line number of the diff, not of the original or changed file. While version control guarantees that the set of changes making up a changeset will never be altered, this is not guaranteed for the diff. The diff changes depending on the "number of lines around each change". The diff might even change depending on the algorithm that is used for diffing.

Note that the bug is also reproducible the other way around:

  1. Comment on a line of a commit
  2. Change the "number of lines around each change"
  3. Observe the comment being displayed in the wrong position.

@SebDieBln
Copy link

Also note that it happens with all parameters of the diff view:

  • display of the diff (side-by-side or above-each-other)
  • lines to be ignored (empty lines, case changes only, blanks)
  • number of context lines

All of these settings influence what is being shown on the screen, and the code comment is referenced to what is shown on the screen, not the actual line of code.

@SebDieBln
Copy link

I'm almost finished writing a fix for that. In order to keep things simple I would like to migrate any old comments from line-comments (inside the diff) to changeset-comments (at the very bottom of the changeset). The information about what line of the diff the comment was originally created on would be added to the text of each comment.

This allows for not having to maintain the old functionality of attaching a comment to a line of the diff.

@rjollos what do you think?

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

Successfully merging a pull request may close this issue.

2 participants