From 9d2f254f6ee55d82e1a8e79f15189b67edcf62b2 Mon Sep 17 00:00:00 2001 From: Olly Betts Date: Mon, 22 Aug 2016 12:27:39 +1200 Subject: [PATCH] Set file.lpos to point to the start of line again The last commit changed it to point one character in, and then compensated in the multiple places where we calculate the column - it's cleaner to just set it to the value it used to have. --- src/datain.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/datain.c b/src/datain.c index 32187cea..7d92be54 100644 --- a/src/datain.c +++ b/src/datain.c @@ -130,7 +130,7 @@ compile_v_report(int severity, int en, va_list ap) error_list_parent_files(); if (en < 0) { en = -en; - if (file.fh) col = ftell(file.fh) - file.lpos + 1; + if (file.fh) col = ftell(file.fh) - file.lpos; } v_report(severity, file.filename, file.line, col, en, ap); } @@ -161,7 +161,7 @@ compile_error_reading(reading r, int en, ...) int col = 0; va_start(ap, en); error_list_parent_files(); - if (LOC(r) >= file.lpos) col = LOC(r) - file.lpos + 1; + if (LOC(r) >= file.lpos) col = LOC(r) - file.lpos; v_report(1, file.filename, file.line, col, en, ap); va_end(ap); } @@ -173,7 +173,7 @@ compile_error_reading_skip(reading r, int en, ...) int col = 0; va_start(ap, en); error_list_parent_files(); - if (LOC(r) >= file.lpos) col = LOC(r) - file.lpos + 1; + if (LOC(r) >= file.lpos) col = LOC(r) - file.lpos; v_report(1, file.filename, file.line, col, en, ap); va_end(ap); skipline(); @@ -299,7 +299,7 @@ process_eol(void) } if (ch == '\n') eolchar = ch; } - file.lpos = ftell(file.fh); + file.lpos = ftell(file.fh) - 1; } static bool -- 2.11.4.GIT