Skip to content

Commit

Permalink
io: only increment line number for LF, not for CR
Browse files Browse the repository at this point in the history
This avoids counting lines terminated by CRLF twice
  • Loading branch information
fingolfin committed Feb 28, 2018
1 parent f968f51 commit cfcac20
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -1163,8 +1163,7 @@ Char GetLine ( void )
}

/* bump the line number */
if (IO()->Input->line < STATE(In) &&
(*(STATE(In) - 1) == '\n' || *(STATE(In) - 1) == '\r')) {
if (IO()->Input->line < STATE(In) && *(STATE(In) - 1) == '\n') {
IO()->Input->number++;
}

Expand Down

0 comments on commit cfcac20

Please sign in to comment.