diff --git a/aqt/browser.py b/aqt/browser.py index ce802784a..a2e5a225f 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -207,11 +207,13 @@ class DataModel(QAbstractTableModel): tv = self.browser.form.tableView if idx: tv.selectRow(idx.row()) - # we save and then restore the horizontal scroll position because - # scrollTo() also scrolls horizontally which is confusing - h = tv.horizontalScrollBar().value() - tv.scrollTo(idx, tv.PositionAtCenter) - tv.horizontalScrollBar().setValue(h) + # scroll if the selection count has changed + if count != len(self.selectedCards): + # we save and then restore the horizontal scroll position because + # scrollTo() also scrolls horizontally which is confusing + h = tv.horizontalScrollBar().value() + tv.scrollTo(idx, tv.PositionAtCenter) + tv.horizontalScrollBar().setValue(h) if count < 500: # discard large selections; they're too slow sm.select(items, QItemSelectionModel.SelectCurrent |