@@ -308,6 +308,7 @@ def smarter_request_reload(desc):
308
308
self .stdin = FakeStdin (self .coderunner , self , self .edit_keys )
309
309
310
310
self .request_paint_to_clear_screen = False # next paint should clear screen
311
+ self .inconsistent_history = False # offscreen command yields different result from history
311
312
self .last_events = [None ] * 50 # some commands act differently based on the prev event
312
313
# this list doesn't include instances of event.Event,
313
314
# only keypress-type events (no refresh screen events etc.)
@@ -1020,7 +1021,11 @@ def paint(self, about_to_exit=False, user_quit=False):
1020
1021
else :
1021
1022
arr = FSArray (0 , width )
1022
1023
#TODO test case of current line filling up the whole screen (there aren't enough rows to show it)
1023
-
1024
+ if self .inconsistent_history == True :
1025
+ msg = "#<---History inconsistent with output shown--->"
1026
+ arr [0 , 0 :min (len (msg ), width )] = [msg [:width ]]
1027
+ self .inconsistent_history = False
1028
+ """FIX THE THING This if may need to go after the second one, but the while applies to both"""
1024
1029
if current_line_start_row < 0 : #if current line trying to be drawn off the top of the screen
1025
1030
logger .debug ('#<---History contiguity broken by rewind--->' )
1026
1031
msg = "#<---History contiguity broken by rewind--->"
@@ -1216,10 +1221,13 @@ def reprint_line(self, lineno, tokens):
1216
1221
logger .debug ("calling reprint line with %r %r" , lineno , tokens )
1217
1222
if self .config .syntax :
1218
1223
self .display_buffer [lineno ] = bpythonparse (format (tokens , self .formatter ))
1224
+
1225
+ return self .display_lines
1219
1226
def reevaluate (self , insert_into_history = False ):
1220
1227
"""bpython.Repl.undo calls this"""
1221
1228
if self .watcher : self .watcher .reset ()
1222
1229
old_logical_lines = self .history
1230
+ old_display_lines = self .display_lines
1223
1231
self .history = []
1224
1232
self .display_lines = []
1225
1233
@@ -1242,7 +1250,9 @@ def reevaluate(self, insert_into_history=False):
1242
1250
self .process_event (events .RefreshRequestEvent ())
1243
1251
sys .stdin = self .stdin
1244
1252
self .reevaluating = False
1245
-
1253
+ num_lines_onscreen = len (self .lines_for_display )- max (0 , self .scroll_offset )
1254
+ if old_display_lines [:len (self .display_lines )- num_lines_onscreen ]!= self .display_lines :
1255
+ self .inconsistent_history = True
1246
1256
self .cursor_offset = 0
1247
1257
self .current_line = ''
1248
1258
0 commit comments