mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-05 22:23:42 +02:00
Fix off by one error when finding closest line number for an element
This commit is contained in:
parent
c344aaca7e
commit
d5096c09b6
1 changed files with 4 additions and 4 deletions
|
|
@ -266,10 +266,10 @@ def uniq(vals):
|
|||
|
||||
def find_le(a, x):
|
||||
'Find rightmost value in a less than or equal to x'
|
||||
i = bisect_right(a, x)
|
||||
if i:
|
||||
return a[i-1]
|
||||
raise ValueError
|
||||
try:
|
||||
return a[bisect_right(a, x)]
|
||||
except IndexError:
|
||||
return a[-1]
|
||||
|
||||
class WebPage(QWebPage):
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue