Page MenuHomePhabricator

Last block of blocked Jupyter notebook diffs is not displayed in side-by-side view
Closed, ResolvedPublic

Description

Last block of Jupyter notebook is not displayed in side-by-side view, it is displayed in unified view though. Issue happen on latest phabricator master. (regression since introduction I think).
Side-by-side


Unified:

Example Jupyter notebook:

Differential revision: D20932

Event Timeline

artms created this task.Nov 28 2019, 10:57 AM
epriestley triaged this task as Low priority.Jan 30 2020, 3:36 PM
epriestley added a project: Differential.

In DifferentialHunkParser->generateVisibleLinesMask(), we pass a 0-based array in and get a 1-based ("line number") array out. The loop condition stops us from reaching the last line of the 0-based array.

This is easy to fix by changing < $max_length to <= $max_length, but I don't immediately understand why this isn't broken for all files, since the same method is used for normal source files.

It looks like there are several other bugs where $mask is inconsistently adjusted in calculateGapsAndMask(), and then inconsistently used in renderTextChange().

This causes the issue worked around here, as well:

// TODO: There's currently a bug where one-line files get incorrectly
// masked. This causes images to completely fail to render. Just ignore
// the mask if it came back empty.
if (!$mask) {
  $is_visible = true;
}

I'd like to unify all this code eventually, but I think I'm going to fix this fairly narrowly for the moment.

The underlying code is still a bit shaky, so let me know if you catch other issues.