##// END OF EJS Templates
[qtconsole] carriage-return action matches CR only, not CRLF...
MinRK -
Show More
@@ -38,7 +38,7 b" CSI_SUBPATTERN = '\\[(.*?)([%s])' % CSI_COMMANDS"
38 38 OSC_SUBPATTERN = '\](.*?)[\x07\x1b]'
39 39 ANSI_PATTERN = ('\x01?\x1b(%s|%s)\x02?' % \
40 40 (CSI_SUBPATTERN, OSC_SUBPATTERN))
41 ANSI_OR_SPECIAL_PATTERN = re.compile('(\b|\r)|(?:%s)' % ANSI_PATTERN)
41 ANSI_OR_SPECIAL_PATTERN = re.compile('(\b|\r(?!\n))|(?:%s)' % ANSI_PATTERN)
42 42 SPECIAL_PATTERN = re.compile('([\f])')
43 43
44 44 #-----------------------------------------------------------------------------
@@ -105,12 +105,21 b' class TestAnsiCodeProcessor(unittest.TestCase):'
105 105 def test_carriage_return(self):
106 106 """ Are carriage return characters processed correctly?
107 107 """
108 string = 'foo\rbar' # form feed
108 string = 'foo\rbar' # carriage return
109 109 self.assertEquals(list(self.processor.split_string(string)), ['foo', '', 'bar'])
110 110 self.assertEquals(len(self.processor.actions), 1)
111 111 action = self.processor.actions[0]
112 112 self.assertEquals(action.action, 'carriage-return')
113 113
114 def test_carriage_return_newline(self):
115 """transform CRLF to LF"""
116 string = 'foo\rbar\r\ncat\r\n' # carriage return and newline
117 # only one CR action should occur, and '\r\n' should transform to '\n'
118 self.assertEquals(list(self.processor.split_string(string)), ['foo', '', 'bar\r\ncat\r\n'])
119 self.assertEquals(len(self.processor.actions), 1)
120 action = self.processor.actions[0]
121 self.assertEquals(action.action, 'carriage-return')
122
114 123 def test_beep(self):
115 124 """ Are beep characters processed correctly?
116 125 """
General Comments 0
You need to be logged in to leave comments. Login now