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.master
parent
7130177f9a
commit
a92f1260ea
1
edit.c
1
edit.c
|
@ -114,6 +114,7 @@ static void macroExpand(void) {
|
||||||
if (macro == pos) return;
|
if (macro == pos) return;
|
||||||
for (size_t i = 0; i < ARRAY_LEN(Macros); ++i) {
|
for (size_t i = 0; i < ARRAY_LEN(Macros); ++i) {
|
||||||
if (wcsncmp(Macros[i].name, &buf[macro], pos - macro)) continue;
|
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);
|
delete(false, macro, pos - macro);
|
||||||
pos = macro;
|
pos = macro;
|
||||||
size_t expand = wcslen(Macros[i].string);
|
size_t expand = wcslen(Macros[i].string);
|
||||||
|
|
Loading…
Reference in New Issue