Revert "fix enforcement of 1-step indentation"

This reverts commit 8c537aa295.
master
Drew DeVault 6 years ago
parent 8c537aa295
commit cb57eb07d6
  1. 9
      src/main.c
  2. 11
      test/indent

@ -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;

@ -19,14 +19,3 @@ Not indented
Not indented
EOF
end 0
begin "Disallows indentation changes > 1"
scdoc <<EOF >/dev/null
test(8)
Not indented
Indented one level
Indented three levels
Not indented
EOF
end 1

Loading…
Cancel
Save