Open 42sol-eu opened 4 years ago
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.
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?
if I use the
cog.msg( ... )
the first call will be directly printed on theCogging ...
output line.Every following message will be printed on a own separate line.
Suggestion: Add a new_line to the Cogging output