diff --git a/CHANGELOG b/CHANGELOG index 29f9736..3666513 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +v0.3.0 +====== +Now with auto-indent. Let me know if it's annoying. + v0.2.4 ====== Thanks a lot to Angus Gibson for submitting a patch to fix a problem diff --git a/bpython.py b/bpython.py index 5988c9a..8fd8698 100644 --- a/bpython.py +++ b/bpython.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# bpython 0.2.4::fancy curses interface to the Python repl::Bob Farrell 2008 +# bpython 0.3.0::fancy curses interface to the Python repl::Bob Farrell 2008 # # The MIT License # @@ -197,6 +197,7 @@ class Repl: self.f_string = '' self.matches = [] self.argspec = None + self.s = '' if not OPTS.argspec: return @@ -1001,10 +1002,15 @@ class Repl: which returns None if Enter is pressed (that means "Return", idiot).""" - self.ts = '' + indent = self.s.endswith(':') or self.s.startswith('\t') self.s = '' self.iy, self.ix = self.scr.getyx() + + if indent:#self.s_hist and self.s_hist[-1].rstrip().endswith(':'): + self.c = '\t' + self.p_key() + self.c = None self.cpos = 0 while True: