Subject: Re: repeated colored prompts

Re: repeated colored prompts

From: meneldor <meneldor_at_gmail.com>
Date: Mon, 30 Mar 2015 14:13:47 +0300

Im not implementing terminal emulator. Just need to parse the prompt when
any command finishes. Here is an example prompt when i connect to colored
terminal:

]0;testuser_at_sttest:~[testuser_at_sttest ~]$

there are some escape chars here which i didnt paste (for ex. 0x1b, etc).

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

rompt>

rompt> use

rompt>

rompt> use

rompt>

rompt> use

rompt>

rompt> use

rompt>

rompt> use t

rompt>

rompt> use t

rompt>

rompt> use te

rompt>

rompt> use te

rompt>

rompt> use tes

rompt>

rompt> use tes

rompt>

rompt> use test

rompt>

rompt> use test

I have no idea why i receive so many prompts :) If i remove the colors the
prompt returns it only once as expected. Thats why i guessed that there is
something wrong with the calculations of the screen/pty size/columns
because of the un-printable color codes.

On Sun, Mar 29, 2015 at 8:09 PM, Peter Stuge <peter_at_stuge.se> wrote:

> meneldor wrote:
> > I am not sure and just trying to figure out why is this happening.
> > Only if the prompt is colored (for example libssh2_channel_request_pty()
> > "xterm" or "ansi") so there are some escape codes.
>
> You are implementing a terminal emulator. That is completely
> unrelated to the terminal transport, which is what libssh2 is
> in this case.
>
>
> //Peter
> _______________________________________________
> libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
>

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2015-03-30