+ /* If we're not in some kind of quoted construct, the current history
+ entry ends with a newline, and we're going to add a semicolon,
+ don't. In some cases, it results in a syntax error (e.g., before
+ a close brace), and it should not be needed. */
+ if (dstack.delimiter_depth == 0 && current->line[curlen - 1] == '\n' && *chars_to_add == ';')
+ chars_to_add++;
+