selectel / pyte

Simple VTXXX-compatible linux terminal emulator
http://pyte.readthedocs.org/
GNU Lesser General Public License v3.0
649 stars 101 forks source link

screem.display not correct when feed data has many '\x1b[C' chars #129

Open JJJJJJJJames opened 4 years ago

JJJJJJJJames commented 4 years ago

First type some short command, then type a long command, then use up and down or page up and page down key, server will send back stream characters with many '\x1b[C' chars, feed those data and call screen.display, the result is not correct.

superbobry commented 4 years ago

Could you provide a reproducer please? Are you driving the Screen manually or from a pty?

JJJJJJJJames commented 4 years ago

From pty.

I have below output, use debug screen,last command is ["draw", ["eeeeee"], {}], but when I print the screen.display, the result is cccccccccccccccccccccccccccccccceeeeee

output: 'eeeeee\x08\x08\x08\x08\x08\x08qqqqqqqq\x08\x08\x08\x08\x08\x08\x08\x08\x1b[2Peeeeee\x08\x08\x08\x08\x08\x08ccccccc\x08\x08\x08\x08\x08\x08\x08aaaaaaa\x08\x08\x08\x08\x08\x08\x08ccccccccccccccccccccccccccccccccccccccccccc\r\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[Ceeeeeeeeeee\x1b[K\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x1b[2Pddddddddd\x08\x08\x08\x08\x08\x08\x08\x08\x08ccccccccccc\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x1b[2Pddddddddd\x08\x08\x08\x08\x08\x08\x08\x08\x08eeeeeeeeeee\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08\x08ccccccccccccccccccccccccccccccccccccccccccc\r\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[C\x1b[Caaaaaaa\x1b[K\x08\x08\x08\x08\x08\x08\x08ccccccc\x08\x08\x08\x08\x08\x08\x08\x1b[1Peeeeee'