Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
42sol-eu opened this issue Dec 8, 2019 · 2 comments
Open

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

42sol-eu opened this issue Dec 8, 2019 · 2 comments

Comments

@42sol-eu
Copy link

42sol-eu commented Dec 8, 2019

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

@nedbat
Copy link
Owner

nedbat commented Dec 8, 2019

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.

@42sol-eu
Copy link
Author

42sol-eu commented Dec 9, 2019

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 42sol-eu changed the title message dialog will not apear on a new line (on Windows 10?) message line will not apear on a new line (on Windows 10?) Dec 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants