From 9875617f1f471031ee48cb4f51757ba73e08833b Mon Sep 17 00:00:00 2001 From: John Gehrig Date: Mon, 30 Sep 2019 19:51:06 -0400 Subject: [PATCH] FocusGained FocusLost autocmd missing nomodeline Issue#591: Auto folds close when loosing focus. The interaction between neovim-qt calling FocusLost and modelines can cause folds to disappear on their own. This behavior is divergent from nvim. This fix takes a similar solution/approach to the following: https://github.com/onivim/oni/issues/575 --- src/gui/shell.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/shell.cpp b/src/gui/shell.cpp index aaddb7d55..4cb424ae3 100644 --- a/src/gui/shell.cpp +++ b/src/gui/shell.cpp @@ -1351,8 +1351,8 @@ void Shell::closeEvent(QCloseEvent *ev) void Shell::focusInEvent(QFocusEvent *ev) { if (m_attached) { - // See neovim-qt/issues/329 the FocusGained key no longer exists, use autocmd instead - m_nvim->api0()->vim_command("if exists('#FocusGained') | doautocmd FocusGained | endif"); + // Issue #329: The key no longer exists, use autocmd instead. + m_nvim->api0()->vim_command("if exists('#FocusGained') | doautocmd FocusGained | endif"); } QWidget::focusInEvent(ev); } @@ -1360,7 +1360,8 @@ void Shell::focusInEvent(QFocusEvent *ev) void Shell::focusOutEvent(QFocusEvent *ev) { if (m_attached) { - m_nvim->api0()->vim_command("if exists('#FocusLost') | doautocmd FocusLost | endif"); + // Issue #591: Option prevents unwanted interaction, consistent with nvim. + m_nvim->api0()->vim_command("if exists('#FocusLost') | doautocmd FocusLost | endif"); } QWidget::focusOutEvent(ev); }