Keyb shortcuts for next/prev change

This commit is contained in:
Kovid Goyal 2014-01-30 12:22:53 +05:30
parent 4ac45ee354
commit 541611d509
2 changed files with 5 additions and 2 deletions

View File

@ -211,14 +211,14 @@ class Diff(Dialog):
self.bp = b = QToolButton(self)
b.setIcon(QIcon(I('back.png')))
b.clicked.connect(partial(self.view.next_change, -1))
b.setToolTip(_('Go to previous change'))
b.setToolTip(_('Go to previous change') + ' [p]')
b.setText(_('&Previous change')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
l.addWidget(b, r, l.columnCount(), 1, 1)
self.bn = b = QToolButton(self)
b.setIcon(QIcon(I('forward.png')))
b.clicked.connect(partial(self.view.next_change, 1))
b.setToolTip(_('Go to next change'))
b.setToolTip(_('Go to next change') + ' [n]')
b.setText(_('&Next change')), b.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
l.addWidget(b, r, l.columnCount(), 1, 1)

View File

@ -1054,6 +1054,9 @@ class DiffView(QWidget): # {{{
elif key in (Qt.Key_Home, Qt.Key_End):
self.scrollbar.setValue(0 if key == Qt.Key_Home else self.scrollbar.maximum())
return True
elif key in (Qt.Key_N, Qt.Key_P):
self.next_change(1 if key == Qt.Key_N else -1)
return True
if amount is not None:
self.scrollbar.setValue(self.scrollbar.value() + d * amount)