3434#TODO implement paste mode and figure out what the deal with config.paste_time is
3535#TODO figure out how config.auto_display_list=False behaves and implement it
3636#TODO figure out how config.list_win_visible behaves and implement it
37- #TODO implement config.syntax
3837#TODO other autocomplete modes even though I hate them
3938#TODO config.colors_scheme['error']
4039#TODO better status bar message - keybindings like bpython.cli.init_wins
4342#TODO options.interactive, .quiet
4443#TODO execute file if in args
4544
45+ #TODO clarify "formatted" vs "display"
46+
4647logging .basicConfig (level = logging .DEBUG , filename = 'repl.log' , datefmt = '%M:%S' )
4748
4849from bpython .keys import cli_key_dispatch as key_dispatch
@@ -328,7 +329,13 @@ def push(self, line):
328329 err_spot = sys .stderr .tell ()
329330 #logging.debug('running %r in interpreter', self.buffer)
330331 unfinished = self .interp .runsource ('\n ' .join (self .buffer ))
331- self .display_buffer .append (bpythonparse (format (self .tokenize (line ), self .formatter ))) #current line not added to display buffer if quitting
332+
333+ #current line not added to display buffer if quitting
334+ if self .config .syntax :
335+ self .display_buffer .append (bpythonparse (format (self .tokenize (line ), self .formatter )))
336+ else :
337+ self .display_buffer .append (fmtstr (line ))
338+
332339 sys .stdout .seek (out_spot )
333340 sys .stderr .seek (err_spot )
334341 out = sys .stdout .read ()
@@ -354,7 +361,7 @@ def push(self, line):
354361
355362 def unhighlight_paren (self ):
356363 """modify line in self.display_buffer to unhighlight a paren if possible"""
357- if self .highlighted_paren is not None :
364+ if self .highlighted_paren is not None and self . config . syntax :
358365 lineno , saved_tokens = self .highlighted_paren
359366 if lineno == len (self .display_buffer ):
360367 # then this is the current line, so don't worry about it
@@ -369,7 +376,10 @@ def unhighlight_paren(self):
369376 ## formatting, output
370377 @property
371378 def current_formatted_line (self ):
372- fs = bpythonparse (format (self .tokenize (self ._current_line ), self .formatter ))
379+ if self .config .syntax :
380+ fs = bpythonparse (format (self .tokenize (self ._current_line ), self .formatter ))
381+ else :
382+ fs = fmtstr (self ._current_line )
373383 logging .debug ('calculating current formatted line: %r' , repr (fs ))
374384 return fs
375385
@@ -558,7 +568,8 @@ def cpos(self):
558568 return len (self ._current_line ) - self .cursor_offset_in_line
559569 def reprint_line (self , lineno , tokens ):
560570 logging .debug ("calling reprint line with %r %r" , lineno , tokens )
561- self .display_buffer [lineno ] = bpythonparse (format (tokens , self .formatter ))
571+ if self .config .syntax :
572+ self .display_buffer [lineno ] = bpythonparse (format (tokens , self .formatter ))
562573 def reevaluate (self ):
563574 """bpython.Repl.undo calls this"""
564575 #TODO other implementations have a enter no-history method, could do
0 commit comments