Apply upstream fix for EINTR handling in test_vterm test case

Apply upstream fix for test_remove_watch_file flakiness
Apply upstream fix for test_vterm handling of NUL characters
This commit is contained in:
David Cantrell 2017-11-15 14:27:31 -05:00
parent 985a624954
commit 24b99e9bcf

View File

@ -1,9 +1,47 @@
commit c29b072e1f6df12e237a1294e249943222879536
Merge: 1a6772e d32f864
Author: Ian Ward <ian@excess.org>
Date: Tue Aug 22 14:32:39 2017 -0400
commit 701138a380fac06023e5915448af92ba13614cb9
Author: aszlig <aszlig@redmoonstudios.org>
Date: Thu Feb 11 03:14:07 2016 +0100
Merge pull request #243 from Sjc1000/master
vterm: Fix handling of NUL characters
Fixed Terminal widget crashes with Python3
According to the VT100 programmers manual, the NUL character has to be
ignored (at least on our side, because we are not a printer):
http://vt100.net/docs/tp83/appendixb.html
According to the bug reporter the VMS console driver inserts NUL
characters after line feeds and our implementation prints those as "?".
Tested against Python 2.7, 3.2, 3.3, 3.4 and 3.5.
Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Reported-by: Robert Urban <urban@unix-beratung.de>
diff --git a/urwid/tests/test_vterm.py b/urwid/tests/test_vterm.py
index 59fe166..4dadfcc 100644
--- a/urwid/tests/test_vterm.py
+++ b/urwid/tests/test_vterm.py
@@ -143,6 +143,10 @@ class TermTest(unittest.TestCase):
self.write('1\n2\n3\n4\e[2;1f\e[2M')
self.expect('1\n4')
+ def test_nul(self):
+ self.write('a\0b')
+ self.expect('ab')
+
def test_movement(self):
self.write('\e[10;20H11\e[10;0f\e[20C\e[K')
self.expect('\n' * 9 + ' ' * 19 + '1')
diff --git a/urwid/vterm.py b/urwid/vterm.py
index cc4eb7f..0f091ea 100644
--- a/urwid/vterm.py
+++ b/urwid/vterm.py
@@ -671,7 +671,7 @@ class TermCanvas(Canvas):
self.widget.beep()
elif not dc and char in B("\x18\x1a"): # CAN/SUB
self.leave_escape()
- elif not dc and char == B("\x7f"): # DEL
+ elif not dc and char in B("\x00\x7f"): # NUL/DEL
pass # this is ignored
elif self.within_escape:
self.parse_escape(char)