diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/ex_cmds.lua | 34 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 27 | ||||
-rw-r--r-- | src/nvim/getchar.c | 6 | ||||
-rw-r--r-- | src/nvim/globals.h | 3 | ||||
-rw-r--r-- | src/nvim/misc1.c | 15 | ||||
-rw-r--r-- | src/nvim/version.c | 2 |
6 files changed, 52 insertions, 35 deletions
diff --git a/src/nvim/ex_cmds.lua b/src/nvim/ex_cmds.lua index d5d6d39616..c9dd974d11 100644 --- a/src/nvim/ex_cmds.lua +++ b/src/nvim/ex_cmds.lua @@ -127,12 +127,12 @@ return { }, { command='buffer', - flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, EDITCMD, TRLBAR), func='ex_buffer', }, { command='bNext', - flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bprevious', }, { @@ -162,22 +162,22 @@ return { }, { command='bfirst', - flags=bit.bor(BANG, RANGE, NOTADR, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, EDITCMD, TRLBAR), func='ex_brewind', }, { command='blast', - flags=bit.bor(BANG, RANGE, NOTADR, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, EDITCMD, TRLBAR), func='ex_blast', }, { command='bmodified', - flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bmodified', }, { command='bnext', - flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bnext', }, { @@ -187,12 +187,12 @@ return { }, { command='bprevious', - flags=bit.bor(BANG, RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bprevious', }, { command='brewind', - flags=bit.bor(BANG, RANGE, NOTADR, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, EDITCMD, TRLBAR), func='ex_brewind', }, { @@ -1762,47 +1762,47 @@ return { }, { command='sbuffer', - flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, TRLBAR), + flags=bit.bor(BANG, RANGE, NOTADR, BUFNAME, BUFUNL, COUNT, EXTRA, EDITCMD, TRLBAR), func='ex_buffer', }, { command='sbNext', - flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bprevious', }, { command='sball', - flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_buffer_all', }, { command='sbfirst', - flags=bit.bor(TRLBAR), + flags=bit.bor(EDITCMD, TRLBAR), func='ex_brewind', }, { command='sblast', - flags=bit.bor(TRLBAR), + flags=bit.bor(EDITCMD, TRLBAR), func='ex_blast', }, { command='sbmodified', - flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bmodified', }, { command='sbnext', - flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bnext', }, { command='sbprevious', - flags=bit.bor(RANGE, NOTADR, COUNT, TRLBAR), + flags=bit.bor(RANGE, NOTADR, COUNT, EDITCMD, TRLBAR), func='ex_bprevious', }, { command='sbrewind', - flags=bit.bor(TRLBAR), + flags=bit.bor(EDITCMD, TRLBAR), func='ex_brewind', }, { diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 65d4b980b7..359c4b31d1 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -3959,13 +3959,17 @@ static void ex_bunload(exarg_T *eap) */ static void ex_buffer(exarg_T *eap) { - if (*eap->arg) + if (*eap->arg) { eap->errmsg = e_trailing; - else { - if (eap->addr_count == 0) /* default is current buffer */ + } else { + if (eap->addr_count == 0) { // default is current buffer goto_buffer(eap, DOBUF_CURRENT, FORWARD, 0); - else + } else { goto_buffer(eap, DOBUF_FIRST, FORWARD, (int)eap->line2); + } + if (eap->do_ecmd_cmd != NULL) { + do_cmdline_cmd(eap->do_ecmd_cmd); + } } } @@ -3976,6 +3980,9 @@ static void ex_buffer(exarg_T *eap) static void ex_bmodified(exarg_T *eap) { goto_buffer(eap, DOBUF_MOD, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) { + do_cmdline_cmd(eap->do_ecmd_cmd); + } } /* @@ -3985,6 +3992,9 @@ static void ex_bmodified(exarg_T *eap) static void ex_bnext(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, FORWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) { + do_cmdline_cmd(eap->do_ecmd_cmd); + } } /* @@ -3996,6 +4006,9 @@ static void ex_bnext(exarg_T *eap) static void ex_bprevious(exarg_T *eap) { goto_buffer(eap, DOBUF_CURRENT, BACKWARD, (int)eap->line2); + if (eap->do_ecmd_cmd != NULL) { + do_cmdline_cmd(eap->do_ecmd_cmd); + } } /* @@ -4007,6 +4020,9 @@ static void ex_bprevious(exarg_T *eap) static void ex_brewind(exarg_T *eap) { goto_buffer(eap, DOBUF_FIRST, FORWARD, 0); + if (eap->do_ecmd_cmd != NULL) { + do_cmdline_cmd(eap->do_ecmd_cmd); + } } /* @@ -4016,6 +4032,9 @@ static void ex_brewind(exarg_T *eap) static void ex_blast(exarg_T *eap) { goto_buffer(eap, DOBUF_LAST, BACKWARD, 0); + if (eap->do_ecmd_cmd != NULL) { + do_cmdline_cmd(eap->do_ecmd_cmd); + } } int ends_excmd(int c) FUNC_ATTR_CONST diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index 39227cc199..d0eebf8fea 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -3645,10 +3645,8 @@ int check_abbr(int c, char_u *ptr, int col, int mincol) if (vim_strbyte(mp->m_keys, K_SPECIAL) != NULL) { /* might have CSI escaped mp->m_keys */ q = vim_strsave(mp->m_keys); - if (q != NULL) { - vim_unescape_csi(q); - qlen = (int)STRLEN(q); - } + vim_unescape_csi(q); + qlen = (int)STRLEN(q); } /* find entries with right mode and keys */ match = (mp->m_mode & State) diff --git a/src/nvim/globals.h b/src/nvim/globals.h index 5f542eec0c..f53a780efe 100644 --- a/src/nvim/globals.h +++ b/src/nvim/globals.h @@ -606,9 +606,6 @@ EXTERN int exiting INIT(= FALSE); /* TRUE when planning to exit Vim. Might * still keep on running if there is a changed * buffer. */ -EXTERN int really_exiting INIT(= FALSE); -/* TRUE when we are sure to exit, e.g., after - * a deadly signal */ /* volatile because it is used in signal handler deathtrap(). */ EXTERN volatile int full_screen INIT(= FALSE); /* TRUE when doing full-screen output diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index fc848466c6..4f17f84e11 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -3329,32 +3329,35 @@ void prepare_to_exit(void) */ void preserve_exit(void) { + // 'true' when we are sure to exit, e.g., after a deadly signal + static bool really_exiting = false; + // Prevent repeated calls into this method. if (really_exiting) { exit(2); } - really_exiting = TRUE; + really_exiting = true; prepare_to_exit(); out_str(IObuff); - screen_start(); /* don't know where cursor is now */ + screen_start(); // don't know where cursor is now out_flush(); - ml_close_notmod(); /* close all not-modified buffers */ + ml_close_notmod(); // close all not-modified buffers FOR_ALL_BUFFERS(buf) { if (buf->b_ml.ml_mfp != NULL && buf->b_ml.ml_mfp->mf_fname != NULL) { OUT_STR("Vim: preserving files...\n"); - screen_start(); /* don't know where cursor is now */ + screen_start(); // don't know where cursor is now out_flush(); - ml_sync_all(FALSE, FALSE); /* preserve all swap files */ + ml_sync_all(false, false); // preserve all swap files break; } } - ml_close_all(FALSE); /* close all memfiles, without deleting */ + ml_close_all(false); // close all memfiles, without deleting OUT_STR("Vim: Finished.\n"); diff --git a/src/nvim/version.c b/src/nvim/version.c index 2c648eded6..7eb528f91c 100644 --- a/src/nvim/version.c +++ b/src/nvim/version.c @@ -287,7 +287,7 @@ static int included_patches[] = { //453 NA 452, //451, - //450, + 450, 449, //448 NA 447, |