mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
refactor(options)!: graduate shortmess+=f flag
Not everything needs to be crazy overconfigurable. Also fixes a warning in latest clang which didn't approve of the funky math switch statement in append_arg_number
This commit is contained in:
parent
7bd6bd1ef7
commit
f7da472257
@ -247,6 +247,9 @@ The following deprecated functions or APIs were removed.
|
|||||||
|
|
||||||
• Support for legacy treesitter injection queries is removed.
|
• Support for legacy treesitter injection queries is removed.
|
||||||
|
|
||||||
|
• 'shortmess' flags:
|
||||||
|
- |shm-f| is removed. Always uses "(3 of 5)", never "(file 3 of 5)"
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
DEPRECATIONS *news-deprecations*
|
DEPRECATIONS *news-deprecations*
|
||||||
|
|
||||||
|
@ -5391,7 +5391,6 @@ A jump table for the options with a short description can be found at |Q_op|.
|
|||||||
messages, for example with CTRL-G, and to avoid some other messages.
|
messages, for example with CTRL-G, and to avoid some other messages.
|
||||||
It is a list of flags:
|
It is a list of flags:
|
||||||
flag meaning when present ~
|
flag meaning when present ~
|
||||||
f use "(3 of 5)" instead of "(file 3 of 5)" *shm-f*
|
|
||||||
i use "[noeol]" instead of "[Incomplete last line]" *shm-i*
|
i use "[noeol]" instead of "[Incomplete last line]" *shm-i*
|
||||||
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
||||||
m use "[+]" instead of "[Modified]" *shm-m*
|
m use "[+]" instead of "[Modified]" *shm-m*
|
||||||
|
@ -727,6 +727,7 @@ Options:
|
|||||||
Everything is allowed in 'exrc' files since they must be explicitly marked
|
Everything is allowed in 'exrc' files since they must be explicitly marked
|
||||||
trusted.
|
trusted.
|
||||||
*'shelltype'*
|
*'shelltype'*
|
||||||
|
'shortmess' *shm-f* flag (always on, never show "file" in "(3 of 5)")
|
||||||
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
|
*'shortname'* *'sn'* *'noshortname'* *'nosn'*
|
||||||
*'swapsync'* *'sws'*
|
*'swapsync'* *'sws'*
|
||||||
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
|
*'termencoding'* *'tenc'* (Vim 7.4.852 also removed this for Windows)
|
||||||
|
1
runtime/lua/vim/_meta/options.lua
generated
1
runtime/lua/vim/_meta/options.lua
generated
@ -5668,7 +5668,6 @@ vim.bo.sw = vim.bo.shiftwidth
|
|||||||
--- messages, for example with CTRL-G, and to avoid some other messages.
|
--- messages, for example with CTRL-G, and to avoid some other messages.
|
||||||
--- It is a list of flags:
|
--- It is a list of flags:
|
||||||
--- flag meaning when present ~
|
--- flag meaning when present ~
|
||||||
--- f use "(3 of 5)" instead of "(file 3 of 5)" *shm-f*
|
|
||||||
--- i use "[noeol]" instead of "[Incomplete last line]" *shm-i*
|
--- i use "[noeol]" instead of "[Incomplete last line]" *shm-i*
|
||||||
--- l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
--- l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
||||||
--- m use "[+]" instead of "[Modified]" *shm-m*
|
--- m use "[+]" instead of "[Modified]" *shm-m*
|
||||||
|
@ -3221,7 +3221,7 @@ void fileinfo(int fullname, int shorthelp, int dont_truncate)
|
|||||||
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
|
(int)curwin->w_cursor.col + 1, (int)curwin->w_virtcol + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
(void)append_arg_number(curwin, buffer, IOSIZE, !shortmess(SHM_FILE));
|
(void)append_arg_number(curwin, buffer, IOSIZE);
|
||||||
|
|
||||||
if (dont_truncate) {
|
if (dont_truncate) {
|
||||||
// Temporarily set msg_scroll to avoid the message being truncated.
|
// Temporarily set msg_scroll to avoid the message being truncated.
|
||||||
@ -3372,7 +3372,7 @@ void maketitle(void)
|
|||||||
*buf_p = NUL;
|
*buf_p = NUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
append_arg_number(curwin, buf_p, (int)(SPACE_FOR_ARGNR - (size_t)(buf_p - buf)), false);
|
append_arg_number(curwin, buf_p, (int)(SPACE_FOR_ARGNR - (size_t)(buf_p - buf)));
|
||||||
|
|
||||||
xstrlcat(buf_p, " - NVIM", (sizeof(buf) - (size_t)(buf_p - buf)));
|
xstrlcat(buf_p, " - NVIM", (sizeof(buf) - (size_t)(buf_p - buf)));
|
||||||
|
|
||||||
@ -3509,15 +3509,14 @@ void get_rel_pos(win_T *wp, char *buf, int buflen)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Append (file 2 of 8) to "buf[buflen]", if editing more than one file.
|
/// Append (2 of 8) to "buf[buflen]", if editing more than one file.
|
||||||
///
|
///
|
||||||
/// @param wp window whose buffers to check
|
/// @param wp window whose buffers to check
|
||||||
/// @param[in,out] buf string buffer to add the text to
|
/// @param[in,out] buf string buffer to add the text to
|
||||||
/// @param buflen length of the string buffer
|
/// @param buflen length of the string buffer
|
||||||
/// @param add_file if true, add "file" before the arg number
|
|
||||||
///
|
///
|
||||||
/// @return true if it was appended.
|
/// @return true if it was appended.
|
||||||
bool append_arg_number(win_T *wp, char *buf, int buflen, bool add_file)
|
bool append_arg_number(win_T *wp, char *buf, int buflen)
|
||||||
FUNC_ATTR_NONNULL_ALL
|
FUNC_ATTR_NONNULL_ALL
|
||||||
{
|
{
|
||||||
// Nothing to do
|
// Nothing to do
|
||||||
@ -3525,17 +3524,7 @@ bool append_arg_number(win_T *wp, char *buf, int buflen, bool add_file)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *msg;
|
const char *msg = wp->w_arg_idx_invalid ? _(" ((%d) of %d)") : _(" (%d of %d)");
|
||||||
switch ((wp->w_arg_idx_invalid ? 1 : 0) + (add_file ? 2 : 0)) {
|
|
||||||
case 0:
|
|
||||||
msg = _(" (%d of %d)"); break;
|
|
||||||
case 1:
|
|
||||||
msg = _(" ((%d) of %d)"); break;
|
|
||||||
case 2:
|
|
||||||
msg = _(" (file %d of %d)"); break;
|
|
||||||
case 3:
|
|
||||||
msg = _(" (file (%d) of %d)"); break;
|
|
||||||
}
|
|
||||||
|
|
||||||
char *p = buf + strlen(buf); // go to the end of the buffer
|
char *p = buf + strlen(buf); // go to the end of the buffer
|
||||||
vim_snprintf(p, (size_t)(buflen - (p - buf)), msg, wp->w_arg_idx + 1, ARGCOUNT);
|
vim_snprintf(p, (size_t)(buflen - (p - buf)), msg, wp->w_arg_idx + 1, ARGCOUNT);
|
||||||
|
@ -7247,7 +7247,6 @@ return {
|
|||||||
messages, for example with CTRL-G, and to avoid some other messages.
|
messages, for example with CTRL-G, and to avoid some other messages.
|
||||||
It is a list of flags:
|
It is a list of flags:
|
||||||
flag meaning when present ~
|
flag meaning when present ~
|
||||||
f use "(3 of 5)" instead of "(file 3 of 5)" *shm-f*
|
|
||||||
i use "[noeol]" instead of "[Incomplete last line]" *shm-i*
|
i use "[noeol]" instead of "[Incomplete last line]" *shm-i*
|
||||||
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
l use "999L, 888B" instead of "999 lines, 888 bytes" *shm-l*
|
||||||
m use "[+]" instead of "[Modified]" *shm-m*
|
m use "[+]" instead of "[Modified]" *shm-m*
|
||||||
|
@ -1583,7 +1583,7 @@ int build_stl_str_hl(win_T *wp, char *out, size_t outlen, char *fmt, char *opt_n
|
|||||||
|
|
||||||
// Note: The call will only return true if it actually
|
// Note: The call will only return true if it actually
|
||||||
// appended data to the `buf_tmp` buffer.
|
// appended data to the `buf_tmp` buffer.
|
||||||
if (append_arg_number(wp, buf_tmp, (int)sizeof(buf_tmp), false)) {
|
if (append_arg_number(wp, buf_tmp, (int)sizeof(buf_tmp))) {
|
||||||
str = buf_tmp;
|
str = buf_tmp;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user