vim-patch:8.1.0439: recursive use of getcmdline() still not protected (#17726)

Problem:    Recursive use of getcmdline() still not protected.
Solution:   Instead of saving the command buffer when making a call which may
            cause recursiveness, save the buffer when actually being called
            recursively.
438d176e35

Co-authored-by: zeertzjq <zeertzjq@outlook.com>

Clear ccline earlier in save_cmdline() if ccline is in use so that
ccline.prev_ccline can be assigned.
This commit is contained in:
zeertzjq
2022-03-30 08:32:12 +08:00
committed by GitHub
parent 2f37823703
commit e5428d10b5
3 changed files with 59 additions and 92 deletions

View File

@@ -4001,7 +4001,6 @@ static char_u *eval_map_expr(mapblock_T *mp, int c)
char_u *res;
char_u *p = NULL;
char_u *expr = NULL;
char_u *save_cmd;
pos_T save_cursor;
int save_msg_col;
int save_msg_row;
@@ -4013,8 +4012,6 @@ static char_u *eval_map_expr(mapblock_T *mp, int c)
vim_unescape_ks(expr);
}
save_cmd = save_cmdline_alloc();
// Forbid changing text or using ":normal" to avoid most of the bad side
// effects. Also restore the cursor position.
textlock++;
@@ -4045,8 +4042,6 @@ static char_u *eval_map_expr(mapblock_T *mp, int c)
msg_col = save_msg_col;
msg_row = save_msg_row;
restore_cmdline_alloc(save_cmd);
if (p == NULL) {
return NULL;
}