Re: Line-number references wrong by several lines
Re: Line-number references wrong by several lines
- Subject: Re: Line-number references wrong by several lines
- From: Steve Sisak <email@hidden>
- Date: Fri, 1 Feb 2008 10:08:32 -0500
At 12:47 PM +0100 2/1/08, Markus Hitter wrote:
Am 01.02.2008 um 05:09 schrieb Michael Rice:
It amazes me that this problem, which has been around forever,
still plagues development environments and editors in general.
Because there is no definite solution to this? Is \n\r\n an empty
Unix line followed by an empty DOS line or is it a Unix line
followed by a Mac line and another Unix line?
There's a very simple algorithm:
1) As you're parsing through a stream and see either \n or \r treat
it an end of line and remember which you saw.
2) If the next character in the stream is the other, drop it.
This handles any of \n \r \r\n or \n\r with a worst case failure of
an extra blank line or dropped blank line in a file with mixed line
endings which, for most things (including code) isn't an issue.
-Steve
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden