From b64e5c7ffc64568b2fca775ad176a0938cf843e1 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Thu, 17 Aug 2017 18:31:54 +0800 Subject: [PATCH] bug-fix: VVimIndicator causes input method enabled in read mode --- src/vvimindicator.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/vvimindicator.cpp b/src/vvimindicator.cpp index 8e241b47..c0969a1c 100644 --- a/src/vvimindicator.cpp +++ b/src/vvimindicator.cpp @@ -28,10 +28,6 @@ void VVimIndicator::setupUI() m_cmdLineEdit->setProperty("VimCommandLine", true); connect(m_cmdLineEdit, &VVimCmdLineEdit::commandCancelled, this, [this](){ - if (m_vim) { - m_vim->processCommandLineCancelled(); - } - if (m_editTab) { m_editTab->focusTab(); } @@ -39,19 +35,26 @@ void VVimIndicator::setupUI() // NOTICE: m_cmdLineEdit should not hide itself before setting // focus to edit tab. m_cmdLineEdit->hide(); + + if (m_vim) { + m_vim->processCommandLineCancelled(); + } }); connect(m_cmdLineEdit, &VVimCmdLineEdit::commandFinished, this, [this](VVim::CommandLineType p_type, const QString &p_cmd){ - if (m_vim) { - m_vim->processCommandLine(p_type, p_cmd); - } - if (m_editTab) { m_editTab->focusTab(); } m_cmdLineEdit->hide(); + + // Hide the cmd line edit before execute the command. + // If we execute the command first, we will get Chinese input + // method enabled after returning to read mode. + if (m_vim) { + m_vim->processCommandLine(p_type, p_cmd); + } }); connect(m_cmdLineEdit, &VVimCmdLineEdit::commandChanged,