Hey,
I have been trying to print on the command line as a part of my handler implementation. I have been using `nextPutAll: aString;lf.` Apparently, 'lf' does not seem to work. I tried 'cr' too. I am using the latest 7.0 Pharo-vm and pharo image. I tried 'OSPlatform current lineEnding' as suggested by Clement Mastin. But, when I used the 6.0 version the 'lf' message is working fine. Please find the attached image which demonstrates the same. The left terminal is of version 7.0, right one is of 6.0. Can someone help me out with this? |
Hi Rajula
On Sat, Aug 12, 2017 at 12:56 AM, Rajula Vineet <[hidden email]> wrote: Hey, We did some changes to remodularize a bit more the kernel some weeks ago. The correct way to print a line ending is, as Clement pointed out, 'OSPlatform current lineEnding'. That is because there is no portable character for a new line. Each platform has its own. That said, maybe you found a bug :). Since the image before automatically transformed cr's in line endings for a platform, I did a stream decorator that replaces that behaviour for Pharo 7, I just did it to make it work, did not test it further actually. Could you try the following? - seeing what happens if you print a new line twice? nextPutAll: aString; lf;lf - What is the stream you're using to print out? Transcript or Stdout? Could you show the entire expression you're using? - Can you print out the stream you're using? stream nextPutAll: stream asString; lf. Guille Please find the attached image which demonstrates the same. The left
|
|
Rajula, you can debug the code in graphical mode also. Would you mind investigating the bug and proposing a fix? It should not be difficult :) Guille On Sat, Aug 12, 2017 at 3:39 PM, Rajula Vineet <[hidden email]> wrote:
|
Oh ok sure. I will try my best. :)
Rajula |
Hey Guille,
I think I found the fix. But I would like to run by you first. I want to get a review before making a PR. In the method nextPut: in ZnCrProtableWriteStream, when a new line character is sent using 'OSPlatform current lineEnding', there isn`t any statement which satisfies in this nextPut:. So at the end where the character is checked if it`s a new line, when I added a ifFalse statement and added self newline. Full code is as follows nextPut: aCharacter (String crlf includes: aCharacter ) ifFalse: [ previous ifNotNil: [ self newLine ]. ^ stream nextPut: aCharacter ]. previous = Character cr ifTrue: [ self newLine ]. aCharacter ~= Character lf ifTrue: [ previous := aCharacter ] ifFalse:[ self newLine ]. The only change is the last line. Rajula |
Free forum by Nabble | Edit this page |