Move cursor postion seems to be not interpreted
Closed this issue · 4 comments
Hi all,
I'm using pyte
in Robot Framework to validate firmware of embedded system. I have a problem with escape sequence which modifies the string that I want to match. For example, I look for N for PXE
and in buffer I get:
Press F10 key now for boot menu, N for PXX\x1b[03;42HE boot\r\n
or
Press F10 key now for boot menu, N foo\x1b[03;38Hr PXE boot\r\n
This seems to be a problem with the not interpreted change of cursor location. Does anyone faced similar issue? Have you got ideas how to approach debugging/fixing this problem?
@pietrushnic what makes you say that the cursor position escape sequence is not interpreted? I've ran both inputs through the debug screen, and it seems the stream correctly parses them:
$ echo -n "Press F10 key now for boot menu, N for PXX\x1b[03;42HE boot\r\n" | python -m pyte
["draw", ["Press F10 key now for boot menu, N for PXX"], {}]
["cursor_position", [3, 42], {}]
["draw", ["E boot"], {}]
["carriage_return", [], {}]
["linefeed", [], {}]
$ echo -n "Press F10 key now for boot menu, N foo\x1b[03;38Hr PXE boot\r\n" | python -m pyte
["draw", ["Press F10 key now for boot menu, N foo"], {}]
["cursor_position", [3, 38], {}]
["draw", ["r PXE boot"], {}]
["carriage_return", [], {}]
["linefeed", [], {}]
@superbobry please note that Press F10 key now for boot menu, N for PXX
is wrong it should be Press F10 key now for boot menu, N for PXE
. Maybe this is problem of console driver, which puts incorrect characters.
Let me recover this topic and get back to you what is the current state of this problem.
Thanks for a prompt reply. Yes, I've guessed the desired output. Here pyte
would behave as expected if the cursor is on line 3 prior to processing the input:
>>> screen = pyte.Screen(80, 24)
>>> stream = pyte.Stream(screen)
>>> screen.cursor_to_line(3)
>>> stream.feed("Press F10 key now for boot menu, N for PXX\x1b[03;42HE boot\r\n")
>>> print(*screen.display, sep="\n")
Press F10 key now for boot menu, N for PXE boot
@superbobry what I can say is that Robot Framework had wrong parameters order when initializing HistoryScreen, we have patch here, with that patch and pyte v0.8.0
seems like issue is solved.