mirror of
git://github.com/kovidgoyal/calibre.git
synced 2025-12-24 13:05:03 +01:00
Compare books: Fix incorrect scrolling when viewing all text and a large amount of text is present after the final change.
This commit is contained in:
parent
bd95eb57c3
commit
91a229ae38
1 changed files with 7 additions and 8 deletions
|
|
@ -940,7 +940,7 @@ def get_position_from_scrollbar(self, which):
|
|||
changes = self.changes[which]
|
||||
bar = self.bars[which]
|
||||
syncpos = self.syncpos + bar.value()
|
||||
prev = (0, 0, None)
|
||||
prev = 0
|
||||
for i, (top, bot, kind) in enumerate(changes):
|
||||
if syncpos <= bot:
|
||||
if top <= syncpos:
|
||||
|
|
@ -951,15 +951,14 @@ def get_position_from_scrollbar(self, which):
|
|||
ratio = 0
|
||||
return 'in', i, ratio
|
||||
else:
|
||||
# syncpos is after the change
|
||||
offset = syncpos - prev[1]
|
||||
# syncpos is after the previous change
|
||||
offset = syncpos - prev
|
||||
return 'after', i - 1, offset
|
||||
break
|
||||
else:
|
||||
prev = (top, bot, kind)
|
||||
else:
|
||||
offset = syncpos - prev[1]
|
||||
return 'after', len(self.changes) - 1, offset
|
||||
# syncpos is after the current change
|
||||
prev = bot
|
||||
offset = syncpos - prev
|
||||
return 'after', len(changes) - 1, offset
|
||||
|
||||
def scroll_to(self, which, position):
|
||||
changes = self.changes[which]
|
||||
|
|
|
|||
Loading…
Reference in a new issue