From 6c521b09c8231c7b10aedd8dea0de02b199ce2ba Mon Sep 17 00:00:00 2001 From: Jacopo De Simoi Date: Tue, 29 May 2018 10:53:10 -0400 Subject: [PATCH] Use ijkl-arrows rather than vim-arrows --- ui/pageview.cpp | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/ui/pageview.cpp b/ui/pageview.cpp index 89be5c651..dc9ee6570 100644 --- a/ui/pageview.cpp +++ b/ui/pageview.cpp @@ -2015,7 +2015,7 @@ void PageView::keyPressEvent( QKeyEvent * e ) // move/scroll page by using keys switch ( e->key() ) { - case Qt::Key_J: + case Qt::Key_I: case Qt::Key_Down: slotScrollDown( true /* singleStep */ ); break; @@ -2031,11 +2031,21 @@ void PageView::keyPressEvent( QKeyEvent * e ) case Qt::Key_PageUp: case Qt::Key_Backspace: - slotScrollUp(); - break; - + if ( e->key() == Qt::Key_Down + || e->key() == Qt::Key_PageDown + || e->key() == Qt::Key_K ) + { + bool singleStep = e->key() == Qt::Key_Down || e->key() == Qt::Key_K; + slotScrollDown( singleStep ); + } + else + { + bool singleStep = e->key() == Qt::Key_Up || e->key() == Qt::Key_I; + slotScrollUp( singleStep ); + } + break; case Qt::Key_Left: - case Qt::Key_H: + case Qt::Key_J: if ( horizontalScrollBar()->maximum() == 0 ) { //if we cannot scroll we go to the previous page vertically @@ -3880,7 +3890,7 @@ void PageView::selectionStart( const QPoint & pos, const QColor & color, bool /* void PageView::scrollPosIntoView( const QPoint & pos ) { // this number slows the speed of the page by its value, chosen not to be too fast or too slow, the actual speed is determined from the mouse position, not critical - const int damping=6; + const int damping=6; if (pos.x() < horizontalScrollBar()->value()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value())/damping); else if (horizontalScrollBar()->value() + viewport()->width() < pos.x()) d->dragScrollVector.setX((pos.x() - horizontalScrollBar()->value() - viewport()->width())/damping);