mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
vim-patch:8.2.0966: 'shortmess' flag "n" not used in two places
Problem: 'shortmess' flag "n" not used in two places.
Solution: Make use of the "n" flag consistent. (Nick Jensen, closes vim/vim#6245,
closes vim/vim#6244)
722e505d1a
This commit is contained in:
@@ -3084,28 +3084,29 @@ fileinfo(
|
|||||||
}
|
}
|
||||||
|
|
||||||
vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s",
|
vim_snprintf_add((char *)buffer, IOSIZE, "\"%s%s%s%s%s%s",
|
||||||
curbufIsChanged() ? (shortmess(SHM_MOD)
|
curbufIsChanged()
|
||||||
? " [+]" : _(" [Modified]")) : " ",
|
? (shortmess(SHM_MOD) ? " [+]" : _(" [Modified]")) : " ",
|
||||||
(curbuf->b_flags & BF_NOTEDITED)
|
(curbuf->b_flags & BF_NOTEDITED) && !bt_dontwrite(curbuf)
|
||||||
&& !bt_dontwrite(curbuf)
|
? _("[Not edited]") : "",
|
||||||
? _("[Not edited]") : "",
|
(curbuf->b_flags & BF_NEW) && !bt_dontwrite(curbuf)
|
||||||
(curbuf->b_flags & BF_NEW)
|
? new_file_message() : "",
|
||||||
&& !bt_dontwrite(curbuf)
|
(curbuf->b_flags & BF_READERR)
|
||||||
? _("[New file]") : "",
|
? _("[Read errors]") : "",
|
||||||
(curbuf->b_flags & BF_READERR) ? _("[Read errors]") : "",
|
curbuf->b_p_ro
|
||||||
curbuf->b_p_ro ? (shortmess(SHM_RO) ? _("[RO]")
|
? (shortmess(SHM_RO) ? _("[RO]") : _("[readonly]")) : "",
|
||||||
: _("[readonly]")) : "",
|
(curbufIsChanged()
|
||||||
(curbufIsChanged() || (curbuf->b_flags & BF_WRITE_MASK)
|
|| (curbuf->b_flags & BF_WRITE_MASK)
|
||||||
|| curbuf->b_p_ro) ?
|
|| curbuf->b_p_ro)
|
||||||
" " : "");
|
? " " : "");
|
||||||
/* With 32 bit longs and more than 21,474,836 lines multiplying by 100
|
// With 32 bit longs and more than 21,474,836 lines multiplying by 100
|
||||||
* causes an overflow, thus for large numbers divide instead. */
|
// causes an overflow, thus for large numbers divide instead.
|
||||||
if (curwin->w_cursor.lnum > 1000000L)
|
if (curwin->w_cursor.lnum > 1000000L) {
|
||||||
n = (int)(((long)curwin->w_cursor.lnum) /
|
n = (int)(((long)curwin->w_cursor.lnum) /
|
||||||
((long)curbuf->b_ml.ml_line_count / 100L));
|
((long)curbuf->b_ml.ml_line_count / 100L));
|
||||||
else
|
} else {
|
||||||
n = (int)(((long)curwin->w_cursor.lnum * 100L) /
|
n = (int)(((long)curwin->w_cursor.lnum * 100L) /
|
||||||
(long)curbuf->b_ml.ml_line_count);
|
(long)curbuf->b_ml.ml_line_count);
|
||||||
|
}
|
||||||
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
|
if (curbuf->b_ml.ml_flags & ML_EMPTY) {
|
||||||
vim_snprintf_add((char *)buffer, IOSIZE, "%s", _(no_lines_msg));
|
vim_snprintf_add((char *)buffer, IOSIZE, "%s", _(no_lines_msg));
|
||||||
} else if (p_ru) {
|
} else if (p_ru) {
|
||||||
|
@@ -569,20 +569,21 @@ readfile(
|
|||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (dir_of_file_exists(fname))
|
if (dir_of_file_exists(fname)) {
|
||||||
filemess(curbuf, sfname, (char_u *)_("[New File]"), 0);
|
filemess(curbuf, sfname, (char_u *)new_file_message(), 0);
|
||||||
else
|
} else {
|
||||||
filemess(curbuf, sfname,
|
filemess(curbuf, sfname, (char_u *)_("[New DIRECTORY]"), 0);
|
||||||
(char_u *)_("[New DIRECTORY]"), 0);
|
}
|
||||||
/* Even though this is a new file, it might have been
|
// Even though this is a new file, it might have been
|
||||||
* edited before and deleted. Get the old marks. */
|
// edited before and deleted. Get the old marks.
|
||||||
check_marks_read();
|
check_marks_read();
|
||||||
/* Set forced 'fileencoding'. */
|
// Set forced 'fileencoding'.
|
||||||
if (eap != NULL)
|
if (eap != NULL) {
|
||||||
set_forced_fenc(eap);
|
set_forced_fenc(eap);
|
||||||
|
}
|
||||||
apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname,
|
apply_autocmds_exarg(EVENT_BUFNEWFILE, sfname, sfname,
|
||||||
FALSE, curbuf, eap);
|
false, curbuf, eap);
|
||||||
/* remember the current fileformat */
|
// remember the current fileformat
|
||||||
save_file_ff(curbuf);
|
save_file_ff(curbuf);
|
||||||
|
|
||||||
if (aborting()) /* autocmds may abort script processing */
|
if (aborting()) /* autocmds may abort script processing */
|
||||||
@@ -2203,6 +2204,11 @@ static void check_marks_read(void)
|
|||||||
curbuf->b_marks_read = true;
|
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"
|
* buf_write() - write to file "fname" lines "start" through "end"
|
||||||
*
|
*
|
||||||
@@ -3513,8 +3519,8 @@ restore_backup:
|
|||||||
STRCAT(IObuff, _("[Device]"));
|
STRCAT(IObuff, _("[Device]"));
|
||||||
c = TRUE;
|
c = TRUE;
|
||||||
} else if (newfile) {
|
} else if (newfile) {
|
||||||
STRCAT(IObuff, shortmess(SHM_NEW) ? _("[New]") : _("[New File]"));
|
STRCAT(IObuff, new_file_message());
|
||||||
c = TRUE;
|
c = true;
|
||||||
}
|
}
|
||||||
if (no_eol) {
|
if (no_eol) {
|
||||||
msg_add_eol();
|
msg_add_eol();
|
||||||
|
@@ -462,7 +462,7 @@ describe('confirm()', function()
|
|||||||
-- With shortmess-=F
|
-- With shortmess-=F
|
||||||
command('set shortmess-=F')
|
command('set shortmess-=F')
|
||||||
feed(':edit foo<cr>')
|
feed(':edit foo<cr>')
|
||||||
check_and_clear('"foo" [New File] |\n')
|
check_and_clear('"foo" [New] |\n')
|
||||||
|
|
||||||
-- With shortmess+=F
|
-- With shortmess+=F
|
||||||
command('set shortmess+=F')
|
command('set shortmess+=F')
|
||||||
|
@@ -31,7 +31,7 @@ describe(":drop", function()
|
|||||||
{0:~ }|
|
{0:~ }|
|
||||||
{0:~ }|
|
{0:~ }|
|
||||||
{1:tmp1.vim }|
|
{1:tmp1.vim }|
|
||||||
"tmp1.vim" [New File] |
|
"tmp1.vim" [New] |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ describe(":drop", function()
|
|||||||
{0:~ }{2:│}{0:~ }|
|
{0:~ }{2:│}{0:~ }|
|
||||||
{0:~ }{2:│}{0:~ }|
|
{0:~ }{2:│}{0:~ }|
|
||||||
{2:tmp2 [+] tmp1 }|
|
{2:tmp2 [+] tmp1 }|
|
||||||
"tmp3" [New File] |
|
"tmp3" [New] |
|
||||||
]])
|
]])
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
@@ -25,7 +25,7 @@ describe("'shortmess'", function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
"foo" [New File] |
|
"foo" [New] |
|
||||||
]])
|
]])
|
||||||
eq(1, eval('bufnr("%")'))
|
eq(1, eval('bufnr("%")'))
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ describe("'shortmess'", function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
"foo" [New File] |
|
"foo" [New] |
|
||||||
]])
|
]])
|
||||||
eq(1, eval('bufnr("%")'))
|
eq(1, eval('bufnr("%")'))
|
||||||
feed(':edit bar<CR>')
|
feed(':edit bar<CR>')
|
||||||
@@ -59,7 +59,7 @@ describe("'shortmess'", function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
"bar" [New File] |
|
"bar" [New] |
|
||||||
]])
|
]])
|
||||||
eq(2, eval('bufnr("%")'))
|
eq(2, eval('bufnr("%")'))
|
||||||
feed(':bprevious<CR>')
|
feed(':bprevious<CR>')
|
||||||
@@ -68,7 +68,7 @@ describe("'shortmess'", function()
|
|||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
~ |
|
~ |
|
||||||
"foo" [New file] --No lines in buffer-- |
|
"foo" [New] --No lines in buffer-- |
|
||||||
]])
|
]])
|
||||||
eq(1, eval('bufnr("%")'))
|
eq(1, eval('bufnr("%")'))
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user