diff options
author | Matthieu Coudron <mattator@gmail.com> | 2020-06-22 22:40:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-22 22:40:33 +0200 |
commit | 8f30753aa1398eadecf1bd9f6dc71251218b9b2d (patch) | |
tree | 9572999548caca5b79f2c028e88a5cbc1db97319 /src/nvim/fileio.c | |
parent | 21453e8f09b72751d396858b9ea86c0584fd6c89 (diff) | |
parent | b198225361dd87161c494627dfebb3d9ffd6cf5a (diff) | |
download | rneovim-8f30753aa1398eadecf1bd9f6dc71251218b9b2d.tar.gz rneovim-8f30753aa1398eadecf1bd9f6dc71251218b9b2d.tar.bz2 rneovim-8f30753aa1398eadecf1bd9f6dc71251218b9b2d.zip |
Merge pull request #12455 from janlazo/vim-8.0.1554
[RDY]vim-patch:8.0.1554,8.1.1977,8.2.{927,930,932,938,954,963,964,966,980,983,998,999}
Diffstat (limited to 'src/nvim/fileio.c')
-rw-r--r-- | src/nvim/fileio.c | 32 |
1 files changed, 19 insertions, 13 deletions
diff --git a/src/nvim/fileio.c b/src/nvim/fileio.c index f29304867a..20f0cdccc3 100644 --- a/src/nvim/fileio.c +++ b/src/nvim/fileio.c @@ -569,20 +569,21 @@ readfile( return FAIL; } } - if (dir_of_file_exists(fname)) - filemess(curbuf, sfname, (char_u *)_("[New File]"), 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. */ + 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. check_marks_read(); - /* Set forced 'fileencoding'. */ - if (eap != NULL) + // Set forced 'fileencoding'. + if (eap != NULL) { set_forced_fenc(eap); + } apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname, - FALSE, curbuf, eap); - /* remember the current fileformat */ + false, curbuf, eap); + // remember the current fileformat save_file_ff(curbuf); if (aborting()) /* autocmds may abort script processing */ @@ -2203,6 +2204,11 @@ static void check_marks_read(void) curbuf->b_marks_read = true; } +char *new_file_message(void) +{ + return shortmess(SHM_NEW) ? _("[New]") : _("[New File]"); +} + /* * buf_write() - write to file "fname" lines "start" through "end" * @@ -3513,8 +3519,8 @@ restore_backup: STRCAT(IObuff, _("[Device]")); c = TRUE; } else if (newfile) { - STRCAT(IObuff, shortmess(SHM_NEW) ? _("[New]") : _("[New File]")); - c = TRUE; + STRCAT(IObuff, new_file_message()); + c = true; } if (no_eol) { msg_add_eol(); |