bug-fix: VVimIndicator causes input method enabled in read mode

This commit is contained in:
Le Tan 2017-08-17 18:31:54 +08:00
parent 0ded620772
commit b64e5c7ffc

View File

@ -28,10 +28,6 @@ void VVimIndicator::setupUI()
m_cmdLineEdit->setProperty("VimCommandLine", true); m_cmdLineEdit->setProperty("VimCommandLine", true);
connect(m_cmdLineEdit, &VVimCmdLineEdit::commandCancelled, connect(m_cmdLineEdit, &VVimCmdLineEdit::commandCancelled,
this, [this](){ this, [this](){
if (m_vim) {
m_vim->processCommandLineCancelled();
}
if (m_editTab) { if (m_editTab) {
m_editTab->focusTab(); m_editTab->focusTab();
} }
@ -39,19 +35,26 @@ void VVimIndicator::setupUI()
// NOTICE: m_cmdLineEdit should not hide itself before setting // NOTICE: m_cmdLineEdit should not hide itself before setting
// focus to edit tab. // focus to edit tab.
m_cmdLineEdit->hide(); m_cmdLineEdit->hide();
if (m_vim) {
m_vim->processCommandLineCancelled();
}
}); });
connect(m_cmdLineEdit, &VVimCmdLineEdit::commandFinished, connect(m_cmdLineEdit, &VVimCmdLineEdit::commandFinished,
this, [this](VVim::CommandLineType p_type, const QString &p_cmd){ this, [this](VVim::CommandLineType p_type, const QString &p_cmd){
if (m_vim) {
m_vim->processCommandLine(p_type, p_cmd);
}
if (m_editTab) { if (m_editTab) {
m_editTab->focusTab(); m_editTab->focusTab();
} }
m_cmdLineEdit->hide(); 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, connect(m_cmdLineEdit, &VVimCmdLineEdit::commandChanged,