From 8f7f7db861078cdebd196bb0d238683f44db38b1 Mon Sep 17 00:00:00 2001 From: Glutanimate Date: Wed, 1 Mar 2017 20:25:59 +0100 Subject: [PATCH] Preserve tag field focus when switching between cards --- aqt/browser.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aqt/browser.py b/aqt/browser.py index cbdc61d0b..cb6ed6f60 100644 --- a/aqt/browser.py +++ b/aqt/browser.py @@ -1518,8 +1518,12 @@ update cards set usn=?, mod=?, did=? where id in """ + scids, self.editor.saveNow(self._onPreviousCard) def _onPreviousCard(self): + tagfocus = self.editor.tags.hasFocus() f = self.editor.currentField self._moveCur(QAbstractItemView.MoveUp) + if tagfocus: + self.editor.tags.setFocus() + return self.editor.web.setFocus() self.editor.web.eval("focusField(%d)" % f) @@ -1527,8 +1531,12 @@ update cards set usn=?, mod=?, did=? where id in """ + scids, self.editor.saveNow(self._onNextCard) def _onNextCard(self): + tagfocus = self.editor.tags.hasFocus() f = self.editor.currentField self._moveCur(QAbstractItemView.MoveDown) + if tagfocus: + self.editor.tags.setFocus() + return self.editor.web.setFocus() self.editor.web.eval("focusField(%d)" % f)