mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 23:50:18 +00:00
Improved the autoindent stuff
The autoindent should work now with multiple levels of indenting. e.g.: def foo(): def bar(): def baz(): print "hi" print "ho"
This commit is contained in:
+7
-2
@@ -1003,11 +1003,16 @@ class Repl:
|
||||
idiot)."""
|
||||
|
||||
self.ts = ''
|
||||
indent = self.s.endswith(':') or self.s.startswith('\t')
|
||||
n_indent = re.split( '[^\t]', self.s, 1 )[0].count('\t')
|
||||
indent = self.s.endswith(':')
|
||||
self.s = ''
|
||||
self.iy, self.ix = self.scr.getyx()
|
||||
|
||||
if indent:#self.s_hist and self.s_hist[-1].rstrip().endswith(':'):
|
||||
for i in range(n_indent):
|
||||
self.c = '\t'
|
||||
self.p_key()
|
||||
|
||||
if indent:
|
||||
self.c = '\t'
|
||||
self.p_key()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user