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

Juan Vuletich juan at jvuletich.org
Mon Nov 16 22:10:33 UTC 2009


Hi Nicolas,

Nicolas Cellier wrote:
> 1] ABOUT RECENT CHANGES IN TRUNK:
>
> st-80 line end policy was really simple (always CR).
> It was the best choice possible as long as staying in Smalltalk world.
> However, I was kind of fed-up with all the hacks for converting
> to/from various line end flavours, half of which not working...
>
> - Since communicating with external world is vital for my own view of Squeak
> - Since It is far more simple to handle the zoo of line delimiters in Kernel
>   (CompositionScanner / DispalyScanner / String / Stream)
> I just added this support in trunk.
>
> Now, we should be able to import any line termination transparently in
> the image.
> For exporting, nothing changed, we still have to care, no magic here,
> this is driven by external applications requirements.
>   

I think you got this one wrong. In Cuis, in a workspace you can tell the 
line ending of each line (cr, lf or crlf) and you can actually type all 
three. Please try it! Use <Enter>, <Shift-Enter> and <Cmd/Alt-Enter>. 
This way you can edit a text file, and keep it consistent. Otherwise, if 
you edit an existing file that was edited with a Unix or Windows editor 
and add CRs to it it will use more than one convention, without you 
realizing. Showing all in the same way is misleading. Different Strings 
should look different in the editor!

> To profit by the new possibilities, just use:
> - (String>>linesDo:) rather than searching indexOf: Character cr
> - (Stream>>nextLine) rather than upTo: Character cr
>
> There might be some LF/CR-LF support lacking here and there (there are
> so many #cr senders...), but that shouldn't be hard to fix.
>
> 2] IMPORTANT NOTE AND QUESTION:
>
> SocketStream>>nextLine does insist on finding a CR-LF pair.
> This is used in some major protocols.
> But I find this abusive, and would like to change the default behavior
> to that of Stream.
> This would be a nice property that a SocketStream behaves like a
> FileStream or an ExternalStream.
> Should I proceed ?
>
> Nicolas

Cheers,
Juan Vuletich



More information about the Squeak-dev mailing list