Skip to content

Commit 9a0e729

Browse files
committed
Raise end-index by 1 when setting range-parts
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.
1 parent 1e2e204 commit 9a0e729

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

neovim/api/buffer.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ def __setitem__(self, idx, lines):
160160
if start is None:
161161
start = self.start
162162
if end is None:
163-
end = self.end + 1
164-
self._buffer[start:end] = lines
163+
end = self.end
164+
self._buffer[start:end + 1] = lines
165165

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

0 commit comments

Comments
 (0)