Fix bad diff display near empty comment caused edits

In 974daeef2121 we fixed GERRIT-66, a bug about not showing comments
if they were outside of the context of an edit being displayed in the
viewer.  Unfortunately the fixed hinged around creating an empty Edit
object, thus forcing the hunk surrounding the comment to appear.  This
threw off the display code, causing it to render some lines twice, and
in other cases, to omit lines entirely.

We now filter out the unnecessary empty Edit instances within a hunk,
as they served their purpose to hold open the hunk's context large
enough for the viewer to get the lines necessary, but leaving them in
nearby to other Edits may cause display errors.

Bug: GERRIT-220
Signed-off-by: Shawn O. Pearce <>
1 file changed