Skip to content

Commit 4fedab1

Browse files
author
Bob Farrell
committed
Auto-indent added
It was pretty trivial (it just autoindents if a line ends with a colon or if the previous line was indented). committer: Bob Farrell <bob@keys.(none)>
1 parent e1ef045 commit 4fedab1

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

‎CHANGELOG‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
v0.3.0
2+
======
3+
Now with auto-indent. Let me know if it's annoying.
4+
15
v0.2.4
26
======
37
Thanks a lot to Angus Gibson for submitting a patch to fix a problem

‎bpython.py‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
# bpython 0.2.4::fancy curses interface to the Python repl::Bob Farrell 2008
2+
# bpython 0.3.0::fancy curses interface to the Python repl::Bob Farrell 2008
33
#
44
# The MIT License
55
#
@@ -197,6 +197,7 @@ def __init__( self, scr, interp, statusbar=None, idle=None):
197197
self.f_string = ''
198198
self.matches = []
199199
self.argspec = None
200+
self.s = ''
200201

201202
if not OPTS.argspec:
202203
return
@@ -1001,10 +1002,15 @@ def get_line( self ):
10011002
which returns None if Enter is pressed (that means "Return",
10021003
idiot)."""
10031004

1004-
10051005
self.ts = ''
1006+
indent = self.s.endswith(':') or self.s.startswith('\t')
10061007
self.s = ''
10071008
self.iy, self.ix = self.scr.getyx()
1009+
1010+
if indent:#self.s_hist and self.s_hist[-1].rstrip().endswith(':'):
1011+
self.c = '\t'
1012+
self.p_key()
1013+
10081014
self.c = None
10091015
self.cpos = 0
10101016
while True:

0 commit comments

Comments
 (0)