Page MenuHomePhabricator

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

Assigned To
Authored By
Nov 28 2019, 10:57 AM
Referenced Files
F7062879: image.png
Nov 28 2019, 10:57 AM
F7062877: image.png
Nov 28 2019, 10:57 AM
F7062875: say_hello.ipynb
Nov 28 2019, 10:57 AM


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).

image.png (338×1 px, 23 KB)

image.png (423×1 px, 28 KB)

Example Jupyter notebook:

Differential revision: D20932

Event Timeline

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.