mirror of
https://github.com/certbot/certbot.git
synced 2026-06-08 16:22:18 -04:00
Fix a bug in the new index calculations
This commit is contained in:
parent
20b92a3c1f
commit
8f0a5fdc66
1 changed files with 5 additions and 4 deletions
|
|
@ -235,15 +235,16 @@ class UnspacedList(list):
|
|||
|
||||
def _spaced_position(self, idx):
|
||||
"Convert from indexes in the unspaced list to positions in the spaced one"
|
||||
print "lookup", idx
|
||||
spaces = 0
|
||||
pos = 0
|
||||
pos = spaces = 0
|
||||
# Normalize indexes like list[-1] etc, and save the result
|
||||
if idx < 0:
|
||||
idx = len(self) + idx
|
||||
idx0 = idx
|
||||
# Count the number of spaces in the spaced list before idx in the unspaced one
|
||||
while idx != -1:
|
||||
if spacey(self.spaced[pos]):
|
||||
spaces += 1
|
||||
else:
|
||||
idx -= 1
|
||||
pos += 1
|
||||
return idx + spaces
|
||||
return idx0 + spaces
|
||||
|
|
|
|||
Loading…
Reference in a new issue