Comment 11 for bug 2018660

Revision history for this message
Jellby (jellby) wrote :

May I suggest the following patch? (Maybe the 'top' and 'bottom' should be modified too, though):

diff --git a/src/calibre/gui2/library/views.py b/src/calibre/gui2/library/views.py
index 144e3108df..15c6ad7f40 100644
--- a/src/calibre/gui2/library/views.py
+++ b/src/calibre/gui2/library/views.py
@@ -1305,8 +1305,10 @@ def scroll_to_row(self, row):
                 vsb.setValue(vertical_position)
             elif pos == 'bottom':
                 vsb.setValue(vertical_position - viewport_height + cell_height)
- else:
+ elif self.verticalScrollMode() == QAbstractItemView.ScrollMode.ScrollPerPixel:
                 vsb.setValue(vertical_position - ((viewport_height - cell_height) // 2))
+ else:
+ vsb.setValue(row - (viewport_height // (cell_height * 2)))

     @property
     def current_book(self):