Proper handling of tabs
This commit is contained in:
15
src/io.c
15
src/io.c
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user