Subject: Re: repeated colored prompts

Re: repeated colored prompts

From: Peter Stuge <>
Date: Mon, 30 Mar 2015 13:59:21 +0200

meneldor wrote:
> Im not implementing terminal emulator. Just need to parse the prompt when
> any command finishes.

To do that you must implement a proper terminal emulator.

> The things are getting ugly if i open python script which uses python's
> "cmd" lib for custom interactive prompt. So i open that script which
> "should" print the prompt "prompt> ". Then i send "use test\n". The prompt
> is colored. Here is the result:
> rompt> u
> rompt>
> rompt> u
> rompt>
> rompt> us
> rompt>
> rompt> us
> I have no idea why i receive so many prompts :)

Because of how the terminal behaves.

> i guessed that there is something wrong with the calculations of
> the screen/pty size/columns because of the un-printable color codes.

No, what is wrong is that you are not correctly implementing a
terminal emulator. You must do that.


Received on 2015-03-30