diff --git a/src/main.c b/src/main.c index 688b544..2508a7f 100644 --- a/src/main.c +++ b/src/main.c @@ -286,13 +286,10 @@ static int parse_indent(struct parser *p, int *indent, bool write) { ++i; } parser_pushch(p, ch); - if ((ch == '\n' || ch == UTF8_INVALID) && *indent != 0) { - // Don't change indent when we encounter empty lines or EOF + if (ch == '\n' && *indent != 0) { + // Don't change indent when we encounter empty lines return *indent; } - if (abs(i - *indent) > 1) { - parser_fatal(p, "Changed indentation by an amount greater than 1"); - } if (write) { if (i < *indent) { for (int j = *indent; i < j; --j) { @@ -300,6 +297,8 @@ static int parse_indent(struct parser *p, int *indent, bool write) { } } else if (i == *indent + 1) { fprintf(p->output, ".RS 4\n"); + } else if (i != *indent && ch == '\t') { + parser_fatal(p, "Indented by an amount greater than 1"); } } *indent = i; diff --git a/test/indent b/test/indent index 0df281d..087e30c 100755 --- a/test/indent +++ b/test/indent @@ -19,14 +19,3 @@ Not indented Not indented EOF end 0 - -begin "Disallows indentation changes > 1" -scdoc </dev/null -test(8) - -Not indented - Indented one level - Indented three levels -Not indented -EOF -end 1