%@lines doesn't count last line without cr/lf at eof

Jun 2, 2008
21
0
#1
TCC 17.00.51 x64 Windows 2008R2 [Version 6.1.7601]
TCC Build 51 Windows 2008R2 Build 7601 Service Pack 1

Using swedish keyboard and Regional and Language Options: Swedish

Counting lines in an Unicode/ANSI file with %@lines is incorrect if last line doesn't end with cr/lf.
With cr/lf at eof the counting is correct.

Example 1:
Create an Unicode or ANSI file containing 1 line with letter A (1 character long).
Add CR/LF and close the file. %@lines[file] returns 0. Correct.

Example 2:
Create an Unicode/ANSI file containing 1 line with letter A (1 character long) and close the file.
%@lines[file] returns -1. Wrong.

This is working correct in TCMD version 16.

Reproducible: Always.

Best regard
Berndt Berg