[squeak-dev] support of various line ends in trunk

Jimmie Houchin j.squeak at cyberhaus.us
Tue Nov 17 16:14:00 UTC 2009


On 11/17/2009 5:15 AM, Juan Vuletich wrote:
> Igor Stasenko wrote:
>> My 2 cents.
>>
>> Import: a text stream should detect a line-ending sequence
>> automatically, or use explicitly specified line-ending sequence, if it
>>  instructed so.
>> Text editors should not bother with line end formats: their main
>> purpose is to correctly display & edit the text, so its much more
>> important to display it correctly, but quite unimportant in what
>> format the edited text is stored.
>> If current text editor uses cr as line ending - i'm fine with that.
>> Lets then make sure, that it doesn't needs to deal with lf char, since
>> any lf occurences should be wiped out (converted) before going into
>> text editor - at text import stage.
>>
>> Export: at text export, one could always tell , what line endings he
>> wants to see (by default it could use Smalltalk>>platformLineEndings
>> ).
>>
>> I don't think that Squeak meant to be used as a generic-purpose text
>> editor, thus, i don't see real importance in making a smart
>> import-edit-export cycle which should care about preserving line
>> ending sequence unchanged.
>
> There simply should not be any import-edit-export cycle at all. The 
> purpose of an editor is to show the user the characters that comprise 
> the String being edited, and allow him to add / remove characters at 
> will. This is so obvious that I feel silly saying it. Why would some 
> characters be silently messed by the system? I see no reason. It is 
> like the horrible "ASCII mode" in FTP, that breaks every file it 
> downloads.

Simple questions below. I do not necessarily know the answers.

If I open up a Workspace and begin editing, whether Squeak or Cuis, by 
default what kind of line endings do I get?

Will I ever in editing newly created Squeak text/strings by default ever 
have multiple different line-endings?

If I ever have text in Squeak which has multiple line-endings, where did 
it come from?
A file? Regardless of whether that file is on disk or in a stream via 
network.

And if a file then there is somewhere in this process some form of 
reading the file from wherever and bringing into Squeak for reading, 
editing, displaying or whatever.
And if I ever want to use my edits outside of Squeak, then there is the 
process of creating or updating the file with the edits.
Therefore there must be an import/edit-display/export cycle. Otherwise 
it is all internal to Squeak and if so should only use Squeak's defaults.

I personally fail to see why anybody would want to retain multiple line 
ending types in any file or text regardless as to whether they were 
there already or not. They in general only get there from multiple edits 
of the file, from multiple OSes. It is done for interoperability between 
platforms and editors but is not a natural thing for any editor to do 
otherwise. Does any editor anywhere when creating a new document insert 
more than one type of line ending? This is a display of what is natural.

Personally as a simple end user. I would prefer that my files if being 
edited by some editor, somewhere, that it correct all of the crappy 
multiple line endings and simply use the platform native line endings 
when saving the file. I couldn't care less what the text editors 
internal representation was of those line endings. I see no real purpose 
for any file with multiple line endings. Fact is that we are operating 
on some specific platform. Whether Windows, Mac, Linux, BSD or whatever. 
By default and by nature all of those systems have expectations of what 
a line ending is. If I am on my Windows machine I would prefer all files 
I edit to be with Windows preferred line endings. And on my Mac with 
Macs. And on my Ubuntu Linux machine, Linuxes. If I send a file from one 
to another I am pleased if it gets converted to the native format for my 
file on that platform. It is an unpleasant experience to double-click a 
file and see Notepad open up and the entire file is on one line. But if 
I explicitly open the file in WordPad it displays just fine. Yuck!

In text files multiple types of line endings serve absolutely no 
purpose. The are all equivalent and should all be converted to platform 
preference.
And if they serve some purpose and would break something if otherwise 
replaced. We are then talking about an application specific file and 
that is a whole different ballgame.

In general, I want an editor to edit any document, object, etc. as it 
would naturally as if it was also the creator.

This is my opinion. But it is one from a long time of computer usage 
with many OSes and using text files between them. Windows almost always 
has a way of screwing up files with multiple or wrong line endings 
unless you explicitly select a client which does the right thing.





More information about the Squeak-dev mailing list