mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 9.0.1064: code for making 'shortmess' temporarily empty is repeated
Problem: Code for making 'shortmess' temporarily empty is repeated. Solution: Add functions for making 'shortmess' empty and restoring it. (Christian Brabandt, closes #11709)
This commit is contained in:
committed by
Bram Moolenaar
parent
4ab1f4a32f
commit
9aee8ec400
@@ -13,6 +13,9 @@
|
||||
|
||||
#include "vim.h"
|
||||
|
||||
static char_u shm_buf[SHM_LEN];
|
||||
static int set_shm_recursive = 0;
|
||||
|
||||
static char *(p_ambw_values[]) = {"single", "double", NULL};
|
||||
static char *(p_bg_values[]) = {"light", "dark", NULL};
|
||||
static char *(p_bkc_values[]) = {"yes", "auto", "no", "breaksymlink", "breakhardlink", NULL};
|
||||
@@ -2697,3 +2700,40 @@ check_ff_value(char_u *p)
|
||||
{
|
||||
return check_opt_strings(p, p_ff_values, FALSE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Save the acutal 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()
|
||||
{
|
||||
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((char_u *)"shm", 0L, (char_u *)"", 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Restore the shortmess Flags set from the save_clear_shm_value() function.
|
||||
*/
|
||||
void
|
||||
restore_shm_value()
|
||||
{
|
||||
if (--set_shm_recursive == 0)
|
||||
{
|
||||
set_option_value_give_err((char_u *)"shm", 0L, shm_buf, 0);
|
||||
vim_memset(shm_buf, 0, SHM_LEN);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user