palaniyappanBala / klish

Automatically exported from code.google.com/p/klish
Other
0 stars 0 forks source link

Tinyrl - Sending "Erase down" escape codes after each typed character #146

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
--What steps will reproduce the problem?
1. Open Klish with a fake TTY (pexpect?)
2. type a command
3. Command that shows up is:

prompt>[Jc[Jo[Jm[Jm[Ja[Jn[Jd

--What is the expected output? What do you see instead?

I would expect:

prompt>command

--What version of the product are you using? On what operating system?
1.6.8, linux Debian

--Please provide any additional information below.

I would agree that Fake TTY should not open Klish interactively.. One of our 
user uses a fake TTY to open the shell in a webinterface... Their product is 
quite limited and doesn't understand escape sequences.
The terminal sends only command in one block and carriage return.
It can also send ^C to interrupt the command. That's it!

When using Bash, they have no issue since bash doesn't send any escape sequence 
for just typing a command.

I've been digging in the code. I see that tinyrl_redisplay is called for pretty 
much everything over there.

I have couple questions and suggestions:
1/ I am going to see if I can make Klish less call on "redisplay", or if I can 
have redisplay call erase down only when necessary.
2/ q: Should we have Klish support multiple types of $TERM? VT100 is good since 
pretty wide, but ANSI could be interesting as well...
3/ q: Would it be interesting/possible to leverage readline? The advantage 
would be that Klish could leverage features from a well known open source tool 
and plug its own on top.

I will update this issue with a potential patch...

Original issue reported on code.google.com by corent...@gmail.com on 25 Apr 2014 at 8:51

GoogleCodeExporter commented 8 years ago
Attached is a patch that solves my issue.

That patch adds a variable that keeps in mind the length of the previous line
written. If it is greater than the current one, it erases down to eliminate
extra characters. If it is smaller, no need since the new line will overwrite
the smaller line.

Original comment by corent...@gmail.com on 26 Apr 2014 at 9:45

Attachments:

GoogleCodeExporter commented 8 years ago
Yes. It's a real problem with fake ttys. We have it too.
I will think about the right way to solve it. The patch is a workaround only. 
And I think it will fail when you press Up arrow or something else to get 
history. The redisplay() doesn't delete the whole line. It delete only 
difference beetween previous and current line.

Probably klish needs ANSI.

I don't think the readline is appropriate. May be it's not good but now klish 
has too much dependencies with tynirl and the tinyrl is not general.

P.S. Please post the issues to the new issue tracker.

Original comment by serj.kalichev@gmail.com on 29 Apr 2014 at 11:40

GoogleCodeExporter commented 8 years ago
See http://libcode.org/issues/4

Original comment by corent...@gmail.com on 29 Apr 2014 at 5:42

GoogleCodeExporter commented 8 years ago
Moved to the new issue tracker

Original comment by serj.kalichev@gmail.com on 30 Apr 2014 at 12:35