Re: New line in a JTextArea (student learning here)



Wojtek Bok wrote:
Andrew Thompson wrote:
OTOH, using System.getProperty("line.separator"),
is 'forward compatible' in the sense that if any new
OS architectures were to become support, or either
Win/*nix to suddenly change the line separator
(my bet would be Windows), the code would adapt.

Actually *nix should change. The action of moving the cursor to the beginning of a new line is in fact two operations:

Two? How many buttons on your keyboard do you normally press to accomplish this?

- move the cursor down one line
- move the cursor to the beginning of the line

Only for electromechanical teletypewriter machines that supported overprinting and underlining that way. (and their successors that try to be backwards compatible with carriage-control from the days when a carriage was a large lump of metal driven by separate motors for rotation/feed and for horizontal positioning).

So the original DOS specification of CRLF is correct,

Carriage control CR LF long predates DOS so I'm not sure why you picked that as an example. The Unix LF convention was established before DOS existed.

The DOS specification for line separation/termination wasn't original - in the sense of being novel, and it wasn't original - in the sense of being first.

CR LF is only "correct" in the sense of being "traditional".

The ASCII standards didn't define a character or sequence for "line separator" or "line terminator" in stored files.

Just my $0.02 worth.
.


Quantcast