cog icon indicating copy to clipboard operation
cog copied to clipboard

message line will not apear on a new line (on Windows 10?)

Open 42sol-eu opened this issue 6 years ago • 2 comments

if I use the cog.msg( ... ) the first call will be directly printed on the Cogging ... output line.

Every following message will be printed on a own separate line.

Suggestion: Add a new_line to the Cogging output

42sol-eu avatar Dec 08 '19 21:12 42sol-eu

I guess we need a little more management of the output line state? I don't use msg() myself any more, so I didn't notice it was working like this.

nedbat avatar Dec 08 '19 23:12 nedbat

I looked at the code on my fork. It is solvable by putting a state variable inside the CogGenerator like this:

    def start_on_new_line(self):
        """"check if to fill in a \n to start on a new line with the following output.
        """
        if self.inside_line:
            self.inside_line = False
            self.prout('', end='\n')

    def msg(self, s):
        self.start_on_new_line()
        self.prout("Message: "+s)

I am now looking at the test cases. Do you know if there is already one who is looking for the standard output?

42sol-eu avatar Dec 09 '19 06:12 42sol-eu