vim-patch:8.2.3848: cannot use reduce() for a string

Problem:    Cannot use reduce() for a string.
Solution:   Make reduce() work with a string. (Naruhiko Nishino, closes vim/vim#9366)

0ccb5842f5

Omit tv_get_first_char() as it doesn't really save much code.

Co-authored-by: rbtnn <naru123456789@gmail.com>
This commit is contained in:
zeertzjq
2023-08-17 13:41:43 +08:00
parent 7f51829cf7
commit c5576fcc80
6 changed files with 88 additions and 19 deletions

View File

@@ -108,7 +108,7 @@ static const char e_dot_can_only_be_used_on_dictionary_str[]
= N_("E1203: Dot can only be used on a dictionary: %s");
static const char e_empty_function_name[]
= N_("E1192: Empty function name");
static char e_argument_of_str_must_be_list_string_dictionary_or_blob[]
static const char e_argument_of_str_must_be_list_string_dictionary_or_blob[]
= N_("E1250: Argument of %s must be a List, String, Dictionary or Blob");
static char * const namespace_char = "abglstvw";
@@ -5206,7 +5206,6 @@ static void filter_map(typval_T *argvars, typval_T *rettv, filtermap_T filtermap
int len;
for (const char *p = tv_get_string(&argvars[0]); *p != NUL; p += len) {
len = utfc_ptr2len(p);
typval_T tv = {
.v_type = VAR_STRING,
.v_lock = VAR_UNLOCKED,