diff options
| author | C. McEnroe | 2021-02-15 18:40:24 -0500 | 
|---|---|---|
| committer | C. McEnroe | 2021-02-15 18:41:46 -0500 | 
| commit | a92f1260ea8fa662f0944a4941c8d87b37b15761 (patch) | |
| tree | 824184759394468fbf19596cc1bfa9cff0d931a4 | |
| parent | 7130177f9afc33d68ca9b80bbabe63bf04f44510 (diff) | |
Don't expand macro if it can't be converted to mbs
Otherwise expanding a macro could hit the assertion in editBuffer
while converting to mbs for consumption by the rest of the program.
| -rw-r--r-- | edit.c | 1 | 
1 files changed, 1 insertions, 0 deletions
| @@ -114,6 +114,7 @@ static void macroExpand(void) {  	if (macro == pos) return;  	for (size_t i = 0; i < ARRAY_LEN(Macros); ++i) {  		if (wcsncmp(Macros[i].name, &buf[macro], pos - macro)) continue; +		if (wcstombs(NULL, Macros[i].string, 0) == (size_t)-1) continue;  		delete(false, macro, pos - macro);  		pos = macro;  		size_t expand = wcslen(Macros[i].string); | 
