Proper handling of tabs

This commit is contained in:
Nate Choe
2022-05-01 04:08:30 -05:00
parent 4e70c61ae5
commit 7f896ec133
2 changed files with 6 additions and 13 deletions

View File

@@ -38,18 +38,9 @@ char *getline(struct linefile *file) {
ret[len] = '\0';
return ret;
}
if (c == '\t') {
do {
ret = append(ret, ' ', &len, &alloc);
if (ret == NULL)
return NULL;
} while (len % 4 != 0);
}
else {
ret = append(ret, c, &len, &alloc);
if (ret == NULL)
return NULL;
}
ret = append(ret, c, &len, &alloc);
if (ret == NULL)
return NULL;
}
}

View File

@@ -47,7 +47,9 @@ void identifyline(char *line, struct linedata *prev, struct linedata *ret) {
}
if (prev->type != PLAIN) {
for (i = 0; i < 4; ++i) {
if (!isspace(line[i]))
if (line[i] == '\t')
break;
if (line[i] != ' ')
goto notspacecode;
}
ret->type = SPACECODE;