terminal: Handle loss of focus in event loop.

While in a terminal and insert mode, if an event caused loss of focus,
nvim would stay in the terminal event loop causing an inconsistent view
of internal state and/or segfault.

Remove the "term" argument from terminal_enter() as it only makes sense
to call it with curbuf->terminal. Terminate the loop when switched to a
different buffer.

fixes #2301
This commit is contained in:
Scott Prager
2015-04-03 18:44:26 -04:00
parent a69e464f70
commit b6296f4e84
3 changed files with 51 additions and 6 deletions

View File

@@ -246,7 +246,7 @@ edit (
)
{
if (curbuf->terminal) {
terminal_enter(curbuf->terminal, true);
terminal_enter(true);
return false;
}