• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Line-number references wrong by several lines
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Line-number references wrong by several lines


  • Subject: Re: Line-number references wrong by several lines
  • From: Alastair Houghton <email@hidden>
  • Date: Sun, 3 Feb 2008 17:23:48 +0000

On 3 Feb 2008, at 04:32, Jeffrey Oleander wrote:

Why not treat them as line-feeds and carriage-returns?

Because it isn't practical in a text editor. Imagine

  ABCDEF\rGHIJKL

which would render with the GHIJKL over-struck on ABCDEF.

Now the user clicks between A and B.  Where should the cursor go?

Or they click to the right of F.  Where does it go now?

Or maybe they click and drag over DEF. What is selected? How is that displayed?

There are two good ways to deal with the line ending problem:

1. Keep the characters that were in the original file, and guess which convention we're using (or let the user specify). The advantage is that loading and saving a file won't change the file. It might not look right though (for instance, it's quite common to see ^M characters in Emacs, which uses this solution, when a UNIX format text file has been edited using an inappropriate editor on a PC).

2. Try to keep the lines the way the file probably intends them, using an algorithm like Steve's. The advantage is that you see all the line endings, even ones that aren't in the "right" format.

Option 1 is probably best for a text editor, since you don't really want it to change things if it doesn't have to. Option 2 is probably best if you're reading a text file from code, e.g. to read settings or something.

Kind regards,

Alastair.

--
http://alastairs-place.net



_______________________________________________
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


  • Follow-Ups:
    • Re: Line-number references wrong by several lines
      • From: Jeffrey Oleander <email@hidden>
References: 
 >Re: Line-number references wrong by several lines (From: Jeffrey Oleander <email@hidden>)

  • Prev by Date: Sparkle frameworks error linking on Release
  • Next by Date: Re: Line-number references wrong by several lines
  • Previous by thread: Re: Line-number references wrong by several lines
  • Next by thread: Re: Line-number references wrong by several lines
  • Index(es):
    • Date
    • Thread