Skip to content

Commit

Permalink
!!word/m: Prevent empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
ampli committed Jan 23, 2020
1 parent b9708d0 commit 4fa0843
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion link-grammar/dict-common/print-dict.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,15 @@ static void print_expression_tag_end(Dictionary dict, dyn_str *e, const Exp *n,
break;
case Exptag_macro:
if (*indent < 0) break;
dyn_strcat(e, "\n");
/* The sole purpose of the checks before issuing "\n" is to prevent
* empty lines when printing connector macros w/o introducing a
* separate version of this function for connector macro printing. */
if (dyn_strlen(e) > 0)
{
dyn_trimback(e);
if ((dyn_str_value(e)[dyn_strlen(e)-1]) != '\n')
dyn_strcat(e, "\n");
}
for(int i = 0; i < *indent - MACRO_INDENTATION/2; i++)
dyn_strcat(e, " ");
(*indent) -= MACRO_INDENTATION;
Expand Down

0 comments on commit 4fa0843

Please sign in to comment.