1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Hack bugfix for multiline off-by-one (locfile.c)

This commit is contained in:
Brendan Macmillan
2013-05-27 10:00:01 +10:00
parent f0b982795c
commit 7fb5d8c973

View File

@ -66,8 +66,8 @@ static void locfile_locate(struct locfile* l, location loc, const char* fmt, ...
}
int startline = locfile_get_line(l, loc.start);
int offset = l->linemap[startline];
fprintf(stderr, "%.*s\n", locfile_line_length(l, startline), l->data + offset);
fprintf(stderr, "%*s", loc.start - offset, "");
fprintf(stderr, "%.*s\n", locfile_line_length(l, startline)-(startline!=0), l->data + offset +(startline!=0));
fprintf(stderr, "%*s", loc.start - offset -(startline!=0), "");
for (int i = loc.start;
i < loc.end && i < offset + locfile_line_length(l, startline);
i++){