X Tutup
Skip to content

Commit fe7f203

Browse files
auto-indentation working again
--HG-- branch : scroll-frontend
1 parent fb4e0ec commit fe7f203

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

bpython/scrollfrontend/repl.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -424,8 +424,9 @@ def push(self, line, insert_into_history=True):
424424

425425
try:
426426
c = bool(code.compile_command('\n'.join(self.buffer)))
427-
except (ValueError, SyntaxError, ValueError):
428-
c = error = True
427+
self.saved_predicted_parse_error = False
428+
except (ValueError, SyntaxError, OverflowError):
429+
c = self.saved_predicted_parse_error = True
429430
if c:
430431
logging.debug('finished - buffer cleared')
431432
self.display_lines.extend(self.display_buffer_lines)
@@ -440,9 +441,10 @@ def run_code_and_maybe_finish(self, for_code=None):
440441
r = self.coderunner.run_code(for_code=for_code)
441442
if r:
442443
logging.debug("----- Running finish command stuff -----")
443-
logging.debug("run_code return value: %r", r)
444+
logging.debug("saved_indent: %r", self.saved_indent)
444445
unfinished = r == 'unfinished'
445-
err = True #TODO implement this properly - via interp.write_error I suppose
446+
err = self.saved_predicted_parse_error
447+
self.saved_predicted_parse_error = False
446448

447449
indent = self.saved_indent
448450
if err:

0 commit comments

Comments
 (0)
X Tutup