From 027c8abd17d7453630b2600f5d7d6144a3fce39c Mon Sep 17 00:00:00 2001 From: Le Tan Date: Wed, 4 Jul 2018 19:56:19 +0800 Subject: [PATCH] Explorer: support Vim navigation --- src/vexplorer.cpp | 10 ++++++++++ src/vexplorer.h | 2 ++ 2 files changed, 12 insertions(+) diff --git a/src/vexplorer.cpp b/src/vexplorer.cpp index a3f35c98..ba21f482 100644 --- a/src/vexplorer.cpp +++ b/src/vexplorer.cpp @@ -12,6 +12,7 @@ #include "vlineedit.h" #include "vhistorylist.h" #include "vorphanfile.h" +#include "utils/vimnavigationforwidget.h" extern VMainWindow *g_mainWin; @@ -773,3 +774,12 @@ void VExplorer::setRootDirectory(const QString &p_path) setCurrentEntry(idx); } } + +void VExplorer::keyPressEvent(QKeyEvent *p_event) +{ + if (VimNavigationForWidget::injectKeyPressEventForVim(m_tree, p_event)) { + return; + } + + QWidget::keyPressEvent(p_event); +} diff --git a/src/vexplorer.h b/src/vexplorer.h index d681a178..b28c7610 100644 --- a/src/vexplorer.h +++ b/src/vexplorer.h @@ -28,6 +28,8 @@ protected: void focusInEvent(QFocusEvent *p_event) Q_DECL_OVERRIDE; + void keyPressEvent(QKeyEvent *p_event) Q_DECL_OVERRIDE; + private slots: void handleEntryActivated(int p_idx);