Not related to your current question, but about your editor's line-counting abilities. I've had some experience writing editors before, so I thought I would add my two-cents' worth.
If I remember correctly, the area needs 10 and 26 (break and new line).
The ASCII values for newline are 13 (carriage return
\r) and 10 (line feed
\n). Microsoft saves ASCII files with both a charrage return and a line feed
\r\n everywhere you create a new line. Macintosh uses only a carriage return
\r, and Linux uses only a line feed
\n.
So if the whole "carriage return, line feed" issue is the source of confusion, then to make your editor count the lines correctly, I would recommend splitting first on "
\r\n", then on "
\r", then on "
\n". If you handle all three cases in that order, your editor should count the same number of lines as the compiler does (unless the compiler is just stupid and interprets "
\r\n" as two lines, in which case, you could just "dumb down" your editor to do the same).
The other problem I had with line-counting is word-wrap. Just from the screenshots, I don't know if your editor does this or not. If so, make sure your code is taking this into acount when counting the lines (since the compiler does not word-wrap, of course).