aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/option.c
diff options
context:
space:
mode:
authorJames McCoy <jamessan@jamessan.com>2016-09-27 11:16:57 -0400
committerGitHub <noreply@github.com>2016-09-27 11:16:57 -0400
commit36ffb6a7d82ef33e05c4c1aaf846aac92a27df98 (patch)
treeec4dfec7a0320dfd13daf2e6772fbe5073fbd003 /src/nvim/option.c
parentddb9f027126b54e6015401c4f0320db4f25d2a5a (diff)
parent6ca089fd8d91f31b621381abcc2f7ba8453e2474 (diff)
downloadrneovim-36ffb6a7d82ef33e05c4c1aaf846aac92a27df98.tar.gz
rneovim-36ffb6a7d82ef33e05c4c1aaf846aac92a27df98.tar.bz2
rneovim-36ffb6a7d82ef33e05c4c1aaf846aac92a27df98.zip
Merge pull request #5261 from jbradaric/vim-7.4.1961
vim-patch:7.4.1961
Diffstat (limited to 'src/nvim/option.c')
-rw-r--r--src/nvim/option.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 89889aa997..e2a5d38bee 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -3658,14 +3658,16 @@ set_bool_option (
/* when 'insertmode' is set from an autocommand need to do work here */
else if ((int *)varp == &p_im) {
if (p_im) {
- if ((State & INSERT) == 0)
- need_start_insertmode = TRUE;
- stop_insert_mode = FALSE;
- } else {
- need_start_insertmode = FALSE;
- stop_insert_mode = TRUE;
- if (restart_edit != 0 && mode_displayed)
- clear_cmdline = TRUE; /* remove "(insert)" */
+ if ((State & INSERT) == 0) {
+ need_start_insertmode = true;
+ }
+ stop_insert_mode = false;
+ } else if (old_value) { // only reset if it was set previously
+ need_start_insertmode = false;
+ stop_insert_mode = true;
+ if (restart_edit != 0 && mode_displayed) {
+ clear_cmdline = true; // remove "(insert)"
+ }
restart_edit = 0;
}
}