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:
[m]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:
[0;36prompt>[0m u
[0;36prompt>[0m
[0;36prompt>[0m u
[0;36prompt>[0m
[0;36prompt>[0m us
[0;36prompt>[0m
[0;36prompt>[0m us
[0;36prompt>[0m
[0;36prompt>[0m use
[0;36prompt>[0m
[0;36prompt>[0m use
[0;36prompt>[0m
[0;36prompt>[0m use
[0;36prompt>[0m
[0;36prompt>[0m use
[0;36prompt>[0m
[0;36prompt>[0m use t
[0;36prompt>[0m
[0;36prompt>[0m use t
[0;36prompt>[0m
[0;36prompt>[0m use te
[0;36prompt>[0m
[0;36prompt>[0m use te
[0;36prompt>[0m
[0;36prompt>[0m use tes
[0;36prompt>[0m
[0;36prompt>[0m use tes
[0;36prompt>[0m
[0;36prompt>[0m use test
[0;36prompt>[0m
[0;36prompt>[0m 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