aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-05-31 15:53:37 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2020-06-04 20:52:52 -0400
commit64a2884d4cc78e3bbf1632cfe18d9e60a787a93e (patch)
tree07a53aac6ffa71cb583cdd2c278287a72490b49b
parent2298350884b09e1af45859da23c89d072f7de99b (diff)
downloadrneovim-64a2884d4cc78e3bbf1632cfe18d9e60a787a93e.tar.gz
rneovim-64a2884d4cc78e3bbf1632cfe18d9e60a787a93e.tar.bz2
rneovim-64a2884d4cc78e3bbf1632cfe18d9e60a787a93e.zip
vim-patch:8.0.1564: too many #ifdefs
Problem: Too many #ifdefs. Solution: Graduate the +autocmd feature. Takes away 450 #ifdefs and increases code size of tiny Vim by only 40 Kbyte. https://github.com/vim/vim/commit/f2bd8ef2b4507d02c6043affff8f7e85e3414d5f
-rw-r--r--src/nvim/globals.h2
-rw-r--r--src/nvim/main.c7
-rw-r--r--src/nvim/os/signal.c1
3 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/globals.h b/src/nvim/globals.h
index f102c3ddd8..08a217a6e8 100644
--- a/src/nvim/globals.h
+++ b/src/nvim/globals.h
@@ -478,6 +478,8 @@ EXTERN int sc_col; // column for shown command
EXTERN int starting INIT(= NO_SCREEN);
// true when planning to exit. Might keep running if there is a changed buffer.
EXTERN bool exiting INIT(= false);
+// internal value of v:dying
+EXTERN int v_dying INIT(= 0);
// is stdin a terminal?
EXTERN int stdin_isatty INIT(= true);
// is stdout a terminal?
diff --git a/src/nvim/main.c b/src/nvim/main.c
index 6ac9cdfbae..b3a903cbe3 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -621,7 +621,7 @@ void getout(int exitval)
/* Optionally print hashtable efficiency. */
hash_debug_results();
- if (get_vim_var_nr(VV_DYING) <= 1) {
+ if (v_dying <= 1) {
const tabpage_T *next_tp;
// Trigger BufWinLeave for all windows, but only once per buffer.
@@ -670,8 +670,9 @@ void getout(int exitval)
shada_write_file(NULL, false);
}
- if (get_vim_var_nr(VV_DYING) <= 1)
- apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, FALSE, curbuf);
+ if (v_dying <= 1) {
+ apply_autocmds(EVENT_VIMLEAVE, NULL, NULL, false, curbuf);
+ }
profile_dump();
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index 112de9fed8..bfe230b521 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -157,6 +157,7 @@ static void deadly_signal(int signum)
{
// Set the v:dying variable.
set_vim_var_nr(VV_DYING, 1);
+ v_dying = 1;
WLOG("got signal %d (%s)", signum, signal_name(signum));