UnspacedList._spaced_position: support the slice at the end fo the list

- Which is needed for .insert()ing at the end, for instance.
This commit is contained in:
Peter Eckersley
2016-07-21 13:39:13 -07:00
parent e5cb04ee7d
commit 85d9ab4d5c
@@ -279,6 +279,9 @@ class UnspacedList(list):
# Normalize indexes like list[-1] etc, and save the result
if idx < 0:
idx = len(self) + idx
if idx == len(self):
# not an index, but the slice at the end of the list
return len(self.spaced)
if not 0 <= idx < len(self):
raise IndexError("list index out of range")
idx0 = idx