mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04: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
@ -940,7 +940,7 @@ class DiffView(QWidget): # {{{
|
|||||||
changes = self.changes[which]
|
changes = self.changes[which]
|
||||||
bar = self.bars[which]
|
bar = self.bars[which]
|
||||||
syncpos = self.syncpos + bar.value()
|
syncpos = self.syncpos + bar.value()
|
||||||
prev = (0, 0, None)
|
prev = 0
|
||||||
for i, (top, bot, kind) in enumerate(changes):
|
for i, (top, bot, kind) in enumerate(changes):
|
||||||
if syncpos <= bot:
|
if syncpos <= bot:
|
||||||
if top <= syncpos:
|
if top <= syncpos:
|
||||||
@ -951,15 +951,14 @@ class DiffView(QWidget): # {{{
|
|||||||
ratio = 0
|
ratio = 0
|
||||||
return 'in', i, ratio
|
return 'in', i, ratio
|
||||||
else:
|
else:
|
||||||
# syncpos is after the change
|
# syncpos is after the previous change
|
||||||
offset = syncpos - prev[1]
|
offset = syncpos - prev
|
||||||
return 'after', i - 1, offset
|
return 'after', i - 1, offset
|
||||||
break
|
|
||||||
else:
|
else:
|
||||||
prev = (top, bot, kind)
|
# syncpos is after the current change
|
||||||
else:
|
prev = bot
|
||||||
offset = syncpos - prev[1]
|
offset = syncpos - prev
|
||||||
return 'after', len(self.changes) - 1, offset
|
return 'after', len(changes) - 1, offset
|
||||||
|
|
||||||
def scroll_to(self, which, position):
|
def scroll_to(self, which, position):
|
||||||
changes = self.changes[which]
|
changes = self.changes[which]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user