@@ -62,7 +62,7 @@ def test_run_line(self):
62
62
orig_stdout = sys .stdout
63
63
sys .stdout = self .repl .stdout
64
64
[self .repl .add_normal_character (c ) for c in '1 + 1' ]
65
- self .repl .on_enter ()
65
+ self .repl .on_enter (insert_into_history = False )
66
66
screen = fsarray ([u'>>> 1 + 1' , '2' , 'Welcome to' ])
67
67
self .assert_paint_ignoring_formatting (screen , (1 , 1 ))
68
68
finally :
@@ -105,7 +105,8 @@ def enter(self, line=None):
105
105
if line is not None :
106
106
self .repl .current_line = line
107
107
with output_to_repl (self .repl ):
108
- self .repl .on_enter ()
108
+ self .repl .on_enter (insert_into_history = False )
109
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
109
110
self .send_refreshes ()
110
111
111
112
def undo (self ):
@@ -432,7 +433,7 @@ def test_cursor_stays_at_bottom_of_screen(self):
432
433
self .repl .width = 50
433
434
self .repl .current_line = "__import__('random').__name__"
434
435
with output_to_repl (self .repl ):
435
- self .repl .on_enter ()
436
+ self .repl .on_enter (insert_into_history = False )
436
437
screen = [u">>> __import__('random').__name__" ,
437
438
u"'random'" ]
438
439
self .assert_paint_ignoring_formatting (screen )
@@ -451,15 +452,28 @@ def test_cursor_stays_at_bottom_of_screen(self):
451
452
u">>> " ]
452
453
self .assert_paint_ignoring_formatting (screen , (2 , 4 ))
453
454
454
- def test_unhighlight_paren_bug (self ):
455
- """infobox showing up during intermediate render was causing this to fail, #371"""
455
+ def test_unhighlight_paren_bugs (self ):
456
+ """two previous bugs, paren did't highlight until next render
457
+ and paren didn't unhighlight until enter"""
458
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
456
459
self .enter ('(' )
460
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
457
461
screen = [u">>> (" ,
458
462
u"... " ]
463
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
459
464
self .assert_paint_ignoring_formatting (screen )
465
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
460
466
461
467
with output_to_repl (self .repl ):
468
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
462
469
self .repl .process_event (')' )
470
+ self .assertEqual (self .repl .rl_history .entries , ['' ])
471
+ screen = fsarray ([cyan (u">>> " )+ on_magenta (bold (red ('(' ))),
472
+ green (u"... " )+ on_magenta (bold (red (')' )))])
473
+ self .assert_paint (screen , (1 , 5 ))
474
+
475
+ with output_to_repl (self .repl ):
476
+ self .repl .process_event (' ' )
463
477
screen = fsarray ([cyan (u">>> " )+ yellow ('(' ),
464
- green (u"... " )+ yellow (')' )])
465
- self .assert_paint (screen , (1 , 3 ))
478
+ green (u"... " )+ yellow (')' )+ bold ( cyan ( " " )) ])
479
+ self .assert_paint (screen , (1 , 6 ))
0 commit comments