mirror of
https://github.com/neovim/neovim.git
synced 2025-09-29 14:38:32 +00:00
refactor: remove 'shortmess' save/restore panic for ex commands
This was only used to avoid the effect of SHM_OVERALL. This can easily be handled in isolation, instead of clearing out all of 'shortmess' which has unwanted side effects and mystifies what really is going on.
This commit is contained in:
@@ -69,8 +69,6 @@ static const char e_backupext_and_patchmode_are_equal[]
|
||||
= N_("E589: 'backupext' and 'patchmode' are equal");
|
||||
static const char e_showbreak_contains_unprintable_or_wide_character[]
|
||||
= N_("E595: 'showbreak' contains unprintable or wide character");
|
||||
static const char e_internal_error_shortmess_too_long[]
|
||||
= N_("E1336: Internal error: shortmess too long");
|
||||
|
||||
static char *(p_ambw_values[]) = { "single", "double", NULL };
|
||||
static char *(p_bg_values[]) = { "light", "dark", NULL };
|
||||
@@ -2269,36 +2267,6 @@ int check_ff_value(char *p)
|
||||
return check_opt_strings(p, p_ff_values, false);
|
||||
}
|
||||
|
||||
static char shm_buf[SHM_LEN];
|
||||
static int set_shm_recursive = 0;
|
||||
|
||||
/// Save the actual shortmess Flags and clear them temporarily to avoid that
|
||||
/// file messages overwrites any output from the following commands.
|
||||
///
|
||||
/// Caller must make sure to first call save_clear_shm_value() and then
|
||||
/// restore_shm_value() exactly the same number of times.
|
||||
void save_clear_shm_value(void)
|
||||
{
|
||||
if (strlen(p_shm) >= SHM_LEN) {
|
||||
iemsg(e_internal_error_shortmess_too_long);
|
||||
return;
|
||||
}
|
||||
|
||||
if (++set_shm_recursive == 1) {
|
||||
STRCPY(shm_buf, p_shm);
|
||||
set_option_value_give_err("shm", STATIC_CSTR_AS_OPTVAL(""), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/// Restore the shortmess Flags set from the save_clear_shm_value() function.
|
||||
void restore_shm_value(void)
|
||||
{
|
||||
if (--set_shm_recursive == 0) {
|
||||
set_option_value_give_err("shm", CSTR_AS_OPTVAL(shm_buf), 0);
|
||||
memset(shm_buf, 0, SHM_LEN);
|
||||
}
|
||||
}
|
||||
|
||||
static const char e_conflicts_with_value_of_listchars[]
|
||||
= N_("E834: Conflicts with value of 'listchars'");
|
||||
static const char e_conflicts_with_value_of_fillchars[]
|
||||
|
Reference in New Issue
Block a user