Skip to content

Commit 9875617

Browse files
jgehrigequalsraf
authored andcommitted
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: onivim/oni#575
1 parent 1eaad0c commit 9875617

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/gui/shell.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1351,16 +1351,17 @@ void Shell::closeEvent(QCloseEvent *ev)
13511351
void Shell::focusInEvent(QFocusEvent *ev)
13521352
{
13531353
if (m_attached) {
1354-
// See neovim-qt/issues/329 the FocusGained key no longer exists, use autocmd instead
1355-
m_nvim->api0()->vim_command("if exists('#FocusGained') | doautocmd FocusGained | endif");
1354+
// Issue #329: The <FocusGained> key no longer exists, use autocmd instead.
1355+
m_nvim->api0()->vim_command("if exists('#FocusGained') | doautocmd <nomodeline> FocusGained | endif");
13561356
}
13571357
QWidget::focusInEvent(ev);
13581358
}
13591359

13601360
void Shell::focusOutEvent(QFocusEvent *ev)
13611361
{
13621362
if (m_attached) {
1363-
m_nvim->api0()->vim_command("if exists('#FocusLost') | doautocmd FocusLost | endif");
1363+
// Issue #591: Option <nomodeline> prevents unwanted interaction, consistent with nvim.
1364+
m_nvim->api0()->vim_command("if exists('#FocusLost') | doautocmd <nomodeline> FocusLost | endif");
13641365
}
13651366
QWidget::focusOutEvent(ev);
13661367
}

0 commit comments

Comments
 (0)