Skip to content

Commit

Permalink
Raise end-index by 1 when setting range-parts
Browse files Browse the repository at this point in the history
This commit fixes a bug in Range, leading to the last line of a Range
not being able to be replaced via the __setitem__-function as the final
line setting its contents in the buffer the Range is based on assumes the
end-index to be inclusive, which it isn't in Python-slicing-notation.
  • Loading branch information
cherti committed Oct 11, 2017
1 parent 1e2e204 commit 9a0e729
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions neovim/api/buffer.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ def __setitem__(self, idx, lines):
if start is None:
start = self.start
if end is None:
end = self.end + 1
self._buffer[start:end] = lines
end = self.end
self._buffer[start:end + 1] = lines

def __iter__(self):
for i in range(self.start, self.end + 1):
Expand Down

0 comments on commit 9a0e729

Please sign in to comment.