aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/ex_cmds2.c
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-04-16 00:16:36 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-04-16 16:12:52 +0800
commite24a84f18e59b356925a435d5ee3085842415299 (patch)
tree3a2bedadf303d0f4d7524f915e7cdddce14a0d50 /src/nvim/ex_cmds2.c
parent0d9b0fbe579343fa6d6c46e6e1bf6bb8719ea5e0 (diff)
downloadrneovim-e24a84f18e59b356925a435d5ee3085842415299.tar.gz
rneovim-e24a84f18e59b356925a435d5ee3085842415299.tar.bz2
rneovim-e24a84f18e59b356925a435d5ee3085842415299.zip
vim-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 vim/vim#11709) https://github.com/vim/vim/commit/9aee8ec400fe617f6d82441c46a22d0cef6fa3e6 Co-authored-by: Christian Brabandt <cb@256bit.org>
Diffstat (limited to 'src/nvim/ex_cmds2.c')
-rw-r--r--src/nvim/ex_cmds2.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index 6d190df939..4d71285447 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -38,6 +38,7 @@
#include "nvim/move.h"
#include "nvim/normal.h"
#include "nvim/option.h"
+#include "nvim/optionstr.h"
#include "nvim/os/os_defs.h"
#include "nvim/path.h"
#include "nvim/pos.h"
@@ -467,7 +468,6 @@ void ex_listdo(exarg_T *eap)
| (eap->forceit ? CCGD_FORCEIT : 0)
| CCGD_EXCMD)) {
int next_fnum = 0;
- char *p_shm_save;
int i = 0;
// start at the eap->line1 argument/window/buffer
wp = firstwin;
@@ -514,7 +514,9 @@ void ex_listdo(exarg_T *eap)
if (qf_size == 0 || (size_t)eap->line1 > qf_size) {
buf = NULL;
} else {
+ save_clear_shm_value();
ex_cc(eap);
+ restore_shm_value();
buf = curbuf;
i = (int)eap->line1 - 1;
@@ -541,11 +543,9 @@ void ex_listdo(exarg_T *eap)
if (curwin->w_arg_idx != i || !editing_arg_idx(curwin)) {
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
- p_shm_save = xstrdup(p_shm);
- set_option_value_give_err("shm", 0L, "", 0);
+ save_clear_shm_value();
do_argfile(eap, i);
- set_option_value_give_err("shm", 0L, p_shm_save, 0);
- xfree(p_shm_save);
+ restore_shm_value();
}
if (curwin->w_arg_idx != i) {
break;
@@ -610,11 +610,9 @@ void ex_listdo(exarg_T *eap)
// Go to the next buffer. Clear 'shm' to avoid that the file
// message overwrites any output from the command.
- p_shm_save = xstrdup(p_shm);
- set_option_value_give_err("shm", 0L, "", 0);
+ save_clear_shm_value();
goto_buffer(eap, DOBUF_FIRST, FORWARD, next_fnum);
- set_option_value_give_err("shm", 0L, p_shm_save, 0);
- xfree(p_shm_save);
+ restore_shm_value();
// If autocommands took us elsewhere, quit here.
if (curbuf->b_fnum != next_fnum) {
@@ -633,11 +631,9 @@ void ex_listdo(exarg_T *eap)
// Clear 'shm' to avoid that the file message overwrites
// any output from the command.
- p_shm_save = xstrdup(p_shm);
- set_option_value_give_err("shm", 0L, "", 0);
+ save_clear_shm_value();
ex_cnext(eap);
- set_option_value_give_err("shm", 0L, p_shm_save, 0);
- xfree(p_shm_save);
+ restore_shm_value();
// If jumping to the next quickfix entry fails, quit here.
if (qf_get_cur_idx(eap) == qf_idx) {