summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2021-02-15 18:40:24 -0500
committerJune McEnroe <june@causal.agency>2021-02-15 18:41:46 -0500
commita92f1260ea8fa662f0944a4941c8d87b37b15761 (patch)
tree824184759394468fbf19596cc1bfa9cff0d931a4
parentAdd donation link to README (diff)
downloadcatgirl-a92f1260ea8fa662f0944a4941c8d87b37b15761.tar.gz
catgirl-a92f1260ea8fa662f0944a4941c8d87b37b15761.zip
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.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/edit.c b/edit.c
index d9b7673..fc23c58 100644
--- a/edit.c
+++ b/edit.c
@@ -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);
e form /^re$/ or /^re/ with no other special characters, instead unescape the pattern and simply use strncmp. Running on a sqlite3.c amalgamation, the regex version takes ~37s while the strncmp version takes ~1s, producing identical output. Big win! 2021-09-11Also defer printing comment for lone close-parensJune McEnroe 2021-09-10Publish "git-comment"June McEnroe 2021-09-10Add git comment --pretty optionJune McEnroe 2021-09-08Defer printing comment if line is blank or closing braceJune McEnroe This fixes badly indented comments. 2021-09-08Up default min-repeat to 30 linesJune McEnroe 2021-09-08Handle dirty lines in git-commentJune McEnroe 2021-09-08Document and install git-commentJune McEnroe 2021-09-08Add repeat and all options to git-commentJune McEnroe 2021-09-08Add group threshold to git-commentJune McEnroe