comparison src/typval.c @ 28668:53c608c7ea9e v8.2.4858

patch 8.2.4858: K_SPECIAL may be escaped twice Commit: https://github.com/vim/vim/commit/db08887f24d20be11d184ce321bc0890613e42bd Author: zeertzjq <zeertzjq@outlook.com> Date: Mon May 2 22:53:45 2022 +0100 patch 8.2.4858: K_SPECIAL may be escaped twice Problem: K_SPECIAL may be escaped twice. Solution: Avoid double escaping. (closes https://github.com/vim/vim/issues/10340)
author Bram Moolenaar <Bram@vim.org>
date Tue, 03 May 2022 00:00:04 +0200
parents 662d2d5db9a6
children 38f7a132bba3
comparison
equal deleted inserted replaced
28667:7782b07d29ca 28668:53c608c7ea9e
2067 { 2067 {
2068 if (*p == '\\' && p[1] != NUL) 2068 if (*p == '\\' && p[1] != NUL)
2069 { 2069 {
2070 ++p; 2070 ++p;
2071 // A "\<x>" form occupies at least 4 characters, and produces up 2071 // A "\<x>" form occupies at least 4 characters, and produces up
2072 // to 21 characters (3 * 6 for the char and 3 for a modifier): 2072 // to 9 characters (6 for the char and 3 for a modifier):
2073 // reserve space for 18 extra. 2073 // reserve space for 5 extra.
2074 // Each byte in the char could be encoded as K_SPECIAL K_EXTRA x.
2075 if (*p == '<') 2074 if (*p == '<')
2076 extra += 18; 2075 extra += 5;
2077 } 2076 }
2078 } 2077 }
2079 2078
2080 if (*p != '"') 2079 if (*p != '"')
2081 { 2080 {
2166 { 2165 {
2167 int flags = FSK_KEYCODE | FSK_IN_STRING; 2166 int flags = FSK_KEYCODE | FSK_IN_STRING;
2168 2167
2169 if (p[1] != '*') 2168 if (p[1] != '*')
2170 flags |= FSK_SIMPLIFY; 2169 flags |= FSK_SIMPLIFY;
2171 extra = trans_special(&p, end, flags, NULL); 2170 extra = trans_special(&p, end, flags, FALSE, NULL);
2172 if (extra != 0) 2171 if (extra != 0)
2173 { 2172 {
2174 end += extra; 2173 end += extra;
2175 if (end >= rettv->vval.v_string + len) 2174 if (end >= rettv->vval.v_string + len)
2176 iemsg("eval_string() used more space than allocated"); 2175 iemsg("eval_string() used more space than allocated");