X-Git-Url: https://git.madduck.net/etc/vim.git/blobdiff_plain/65ea568e3301951f26e0e3b98f6d5dc80132e917..154b98579d3904a042fd3e02a9d77a76be63b36c:/black.py diff --git a/black.py b/black.py index f7022d8..05edf1a 100644 --- a/black.py +++ b/black.py @@ -1480,7 +1480,13 @@ class EmptyLineTracker: lines (two on module-level). """ before, after = self._maybe_empty_lines(current_line) - before -= self.previous_after + before = ( + # Black should not insert empty lines at the beginning + # of the file + 0 + if self.previous_line is None + else before - self.previous_after + ) self.previous_after = after self.previous_line = current_line return before, after