mirror of
https://github.com/kennethreitz-archive/bpython-gist.git
synced 2026-06-05 23:50:18 +00:00
help() fixed up so it's internalised
A few people pointed out that help() can cause problems, specifically when the help string is really big, so I've internalised it and injected my own help() function into the interpreter which pages the output, but it's pretty ghetto so I'm open to suggestions for improvement. That said, it's pretty obvious that scrolling up and down (like less) would be the main requested improvement so I should get to work on that at some point.
This commit is contained in:
+18
-2
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python
|
||||
# bpython 0.4.2::fancy curses interface to the Python repl::Bob Farrell 2008
|
||||
# bpython 0.5.0::fancy curses interface to the Python repl::Bob Farrell 2008
|
||||
#
|
||||
# The MIT License
|
||||
#
|
||||
@@ -64,11 +64,20 @@ try:
|
||||
except ImportError:
|
||||
OPTS.argspec = False
|
||||
else:
|
||||
import pydoc
|
||||
OPTS.argspec = True
|
||||
|
||||
import pydoc
|
||||
|
||||
# TODO:
|
||||
#
|
||||
#
|
||||
# No config file yet. This will allow things like "indent depth" for requiring
|
||||
# the user to hit return n times to signify the end of a code block.
|
||||
#
|
||||
# C-l doesn't repaint the screen yet.
|
||||
#
|
||||
# Tab completion does not work if not at the end of the line.
|
||||
#
|
||||
# Triple-quoted strings over multiple lines are not colourised correctly.
|
||||
#
|
||||
# Numerous optimisations can be made but it seems to do all the lookup stuff
|
||||
@@ -719,6 +728,13 @@ class Repl( object ):
|
||||
self.push( line )
|
||||
self.push( '\n' )
|
||||
|
||||
# The regular help() function uses PAGER to display the help, which
|
||||
# screws with bpython.
|
||||
from bpython import internal
|
||||
internal.window = self.scr
|
||||
self.push('from bpython import internal\n')
|
||||
self.push('help = internal._help')
|
||||
|
||||
self.iy, self.ix = self.scr.getyx()
|
||||
more = False
|
||||
while not self.do_exit:
|
||||
|
||||
Reference in New Issue
Block a user