diff options
-rw-r--r-- | runtime/doc/options.txt | 3 | ||||
-rw-r--r-- | runtime/doc/vim_diff.txt | 1 | ||||
-rw-r--r-- | src/nvim/buffer.c | 22 | ||||
-rw-r--r-- | src/nvim/ex_cmds.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_docmd.c | 4 | ||||
-rw-r--r-- | src/nvim/fileio.c | 18 | ||||
-rw-r--r-- | src/nvim/memline.c | 4 | ||||
-rw-r--r-- | src/nvim/quickfix.c | 2 |
8 files changed, 24 insertions, 32 deletions
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index 1966a344b2..b6f9c007ef 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -5532,8 +5532,7 @@ A jump table for the options with a short description can be found at |Q_op|. "Pattern not found", "Back at original", etc. q use "recording" instead of "recording @a" F don't give the file info when editing a file, like `:silent` - was used for the command; note that this also affects messages - from autocommands + was used for the command S do not show search count message when searching, e.g. "[1/5]" diff --git a/runtime/doc/vim_diff.txt b/runtime/doc/vim_diff.txt index f5cd24b734..540043f52d 100644 --- a/runtime/doc/vim_diff.txt +++ b/runtime/doc/vim_diff.txt @@ -375,6 +375,7 @@ Normal commands: Options: 'ttimeout', 'ttimeoutlen' behavior was simplified |jumpoptions| "stack" behavior + 'shortmess' the "F" flag does not affect output from autocommands Shell: Shell output (|:!|, |:make|, …) is always routed through the UI, so it diff --git a/src/nvim/buffer.c b/src/nvim/buffer.c index 5d2d1cebde..8840813b84 100644 --- a/src/nvim/buffer.c +++ b/src/nvim/buffer.c @@ -109,6 +109,7 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags) { int retval = OK; linenr_T line_count; + bool silent = shortmess(SHM_FILEINFO); // Read from the buffer which the text is already filled in and append at // the end. This makes it possible to retry when 'fileformat' or @@ -117,7 +118,7 @@ static int read_buffer(int read_stdin, exarg_T *eap, int flags) retval = readfile(read_stdin ? NULL : curbuf->b_ffname, read_stdin ? NULL : curbuf->b_fname, line_count, (linenr_T)0, (linenr_T)MAXLNUM, eap, - flags | READ_BUFFER); + flags | READ_BUFFER, silent); if (retval == OK) { // Delete the binary lines. while (--line_count >= 0) { @@ -162,6 +163,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) bufref_T old_curbuf; long old_tw = curbuf->b_p_tw; int read_fifo = false; + bool silent = shortmess(SHM_FILEINFO); // The 'readonly' flag is only set when BF_NEVERLOADED is being reset. // When re-entering the same buffer, it should not change, because the @@ -212,7 +214,6 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) curwin->w_valid = 0; if (curbuf->b_ffname != NULL) { - int old_msg_silent = msg_silent; #ifdef UNIX int save_bin = curbuf->b_p_bin; int perm; @@ -231,13 +232,10 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) curbuf->b_p_bin = true; } #endif - if (shortmess(SHM_FILEINFO)) { - msg_silent = 1; - } retval = readfile(curbuf->b_ffname, curbuf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, eap, - flags | READ_NEW | (read_fifo ? READ_FIFO : 0)); + flags | READ_NEW | (read_fifo ? READ_FIFO : 0), silent); #ifdef UNIX if (read_fifo) { curbuf->b_p_bin = save_bin; @@ -246,7 +244,6 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) } } #endif - msg_silent = old_msg_silent; // Help buffer is filtered. if (bt_help(curbuf)) { @@ -262,7 +259,7 @@ int open_buffer(int read_stdin, exarg_T *eap, int flags) curbuf->b_p_bin = true; retval = readfile(NULL, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, - flags | (READ_NEW + READ_STDIN)); + flags | (READ_NEW + READ_STDIN), silent); curbuf->b_p_bin = save_bin; if (retval == OK) { retval = read_buffer(true, eap, flags); @@ -903,14 +900,7 @@ void handle_swap_exists(bufref_T *old_curbuf) buf = old_curbuf->br_buf; } if (buf != NULL) { - int old_msg_silent = msg_silent; - - if (shortmess(SHM_FILEINFO)) { - msg_silent = 1; // prevent fileinfo message - } enter_buffer(buf); - // restore msg_silent, so that the command line will be shown - msg_silent = old_msg_silent; if (old_tw != curbuf->b_p_tw) { check_colorcolumn(curwin); @@ -5611,7 +5601,7 @@ bool buf_contents_changed(buf_T *buf) if (ml_open(curbuf) == OK && readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, - &ea, READ_NEW | READ_DUMMY) == OK) { + &ea, READ_NEW | READ_DUMMY, false) == OK) { // compare the two files line by line if (buf->b_ml.ml_line_count == curbuf->b_ml.ml_line_count) { differ = false; diff --git a/src/nvim/ex_cmds.c b/src/nvim/ex_cmds.c index d4c21bb33f..7564b9326b 100644 --- a/src/nvim/ex_cmds.c +++ b/src/nvim/ex_cmds.c @@ -1387,7 +1387,7 @@ static void do_filter(linenr_T line1, linenr_T line2, exarg_T *eap, char_u *cmd, if (do_out) { if (otmp != NULL) { if (readfile(otmp, NULL, line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, - READ_FILTER) != OK) { + READ_FILTER, false) != OK) { if (!aborting()) { msg_putchar('\n'); semsg(_(e_notread), otmp); diff --git a/src/nvim/ex_docmd.c b/src/nvim/ex_docmd.c index 2311e80de4..0ac571633b 100644 --- a/src/nvim/ex_docmd.c +++ b/src/nvim/ex_docmd.c @@ -7702,13 +7702,13 @@ static void ex_read(exarg_T *eap) return; } i = readfile(curbuf->b_ffname, curbuf->b_fname, - eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); + eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false); } else { if (vim_strchr(p_cpo, CPO_ALTREAD) != NULL) { (void)setaltfname(eap->arg, eap->arg, (linenr_T)1); } i = readfile(eap->arg, NULL, - eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0); + eap->line2, (linenr_T)0, (linenr_T)MAXLNUM, eap, 0, false); } if (i != OK) { if (!aborting()) { diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index 282e25e10e..25c99af41b 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -176,7 +176,7 @@ void filemess(buf_T *buf, char_u *name, char_u *s, int attr) /// /// @return FAIL for failure, NOTDONE for directory (failure), or OK int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_skip, - linenr_T lines_to_read, exarg_T *eap, int flags) + linenr_T lines_to_read, exarg_T *eap, int flags, bool silent) { int fd = 0; int newfile = (flags & READ_NEW); @@ -472,10 +472,12 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski return FAIL; } } - if (dir_of_file_exists(fname)) { - filemess(curbuf, sfname, (char_u *)new_file_message(), 0); - } else { - filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0); + if (!silent) { + if (dir_of_file_exists(fname)) { + filemess(curbuf, sfname, (char_u *)new_file_message(), 0); + } else { + filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0); + } } // Even though this is a new file, it might have been // edited before and deleted. Get the old marks. @@ -658,7 +660,7 @@ int readfile(char_u *fname, char_u *sfname, linenr_T from, linenr_T lines_to_ski // Autocommands may add lines to the file, need to check if it is empty wasempty = (curbuf->b_ml.ml_flags & ML_EMPTY); - if (!recoverymode && !filtering && !(flags & READ_DUMMY)) { + if (!recoverymode && !filtering && !(flags & READ_DUMMY) && !silent) { if (!read_stdin && !read_buffer) { filemess(curbuf, sfname, (char_u *)"", 0); } @@ -1788,7 +1790,7 @@ failed: return OK; // an interrupt isn't really an error } - if (!filtering && !(flags & READ_DUMMY)) { + if (!filtering && !(flags & READ_DUMMY) && !silent) { add_quoted_fname((char *)IObuff, IOSIZE, curbuf, (const char *)sfname); c = false; @@ -5191,7 +5193,7 @@ void buf_reload(buf_T *buf, int orig_mode, bool reload_options) curbuf->b_flags |= BF_CHECK_RO; // check for RO again keep_filetype = true; // don't detect 'filetype' if (readfile(buf->b_ffname, buf->b_fname, (linenr_T)0, (linenr_T)0, - (linenr_T)MAXLNUM, &ea, flags) != OK) { + (linenr_T)MAXLNUM, &ea, flags, false) != OK) { if (!aborting()) { semsg(_("E321: Could not reload \"%s\""), buf->b_fname); } diff --git a/src/nvim/memline.c b/src/nvim/memline.c index 5646b2db15..5c2f494450 100644 --- a/src/nvim/memline.c +++ b/src/nvim/memline.c @@ -994,7 +994,7 @@ void ml_recover(bool checkext) */ if (curbuf->b_ffname != NULL) { orig_file_status = readfile(curbuf->b_ffname, NULL, (linenr_T)0, - (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW); + (linenr_T)0, (linenr_T)MAXLNUM, NULL, READ_NEW, false); } // Use the 'fileformat' and 'fileencoding' as stored in the swap file. @@ -1069,7 +1069,7 @@ void ml_recover(bool checkext) line_count = pp->pb_pointer[idx].pe_line_count; if (readfile(curbuf->b_ffname, NULL, lnum, pp->pb_pointer[idx].pe_old_lnum - 1, line_count, - NULL, 0) != OK) { + NULL, 0, false) != OK) { cannot_open = true; } else { lnum += line_count; diff --git a/src/nvim/quickfix.c b/src/nvim/quickfix.c index a12fb70388..a04bbe3d2b 100644 --- a/src/nvim/quickfix.c +++ b/src/nvim/quickfix.c @@ -5753,7 +5753,7 @@ static buf_T *load_dummy_buffer(char_u *fname, char_u *dirname_start, char_u *re newbuf_to_wipe.br_buf = NULL; readfile_result = readfile(fname, NULL, (linenr_T)0, (linenr_T)0, (linenr_T)MAXLNUM, NULL, - READ_NEW | READ_DUMMY); + READ_NEW | READ_DUMMY, false); newbuf->b_locked--; if (readfile_result == OK && !got_int |