Skip to content

Commit bf1cfb8

Browse files
committed
Fix CSI + HPA sequence
This commit fixes `HPA` character, which is `U+0060` according to https://vt100.net/docs/vt510-rm/HPA.html, but not `U+0027`.
1 parent 61d0c0c commit bf1cfb8

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

pyte/escape.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,4 +149,5 @@
149149
DECSTBM = "r"
150150

151151
#: *Horizontal position adjust*: Same as :data:`CHA`.
152-
HPA = "'"
152+
HPA = "`"
153+

tests/test_stream.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,3 +332,31 @@ def test_byte_stream_select_other_charset():
332332
# c) enable utf-8
333333
stream.select_other_charset("G")
334334
assert stream.use_utf8
335+
336+
337+
def test_csi_cha():
338+
screen = pyte.Screen(10, 2)
339+
stream = pyte.Stream(screen)
340+
# before
341+
assert screen.cursor.x == 0
342+
assert screen.cursor.y == 0
343+
assert screen.display[0] == " "
344+
# set cursor to column absolute
345+
stream.feed("\x9b4`text")
346+
assert screen.cursor.x == 7
347+
assert screen.cursor.y == 0
348+
assert screen.display[0] == " text "
349+
350+
351+
def test_csi_hpa():
352+
screen = pyte.Screen(10, 2)
353+
stream = pyte.Stream(screen)
354+
# before
355+
assert screen.cursor.x == 0
356+
assert screen.cursor.y == 0
357+
assert screen.display[0] == " "
358+
# set cursor to column absolute
359+
stream.feed("\x9b4`text")
360+
assert screen.cursor.x == 7
361+
assert screen.cursor.y == 0
362+
assert screen.display[0] == " text "

0 commit comments

Comments
 (0)