Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions 18 Lib/idlelib/pyshell.py
Original file line number Diff line number Diff line change
Expand Up @@ -938,11 +938,9 @@ def __init__(self, flist=None):
sys.stderr = self.stderr
sys.stdin = self.stdin
try:
# page help() text to shell.
import pydoc # import must be done here to capture i/o rebinding.
# XXX KBK 27Dec07 use text viewer someday, but must work w/o subproc
pydoc.pager = pydoc.plainpager
except:
import pydoc # import must be done here to capture i/o rebinding.
pydoc.pager = self.pager
except Exception:
sys.stderr = sys.__stderr__
raise
#
Expand Down Expand Up @@ -984,6 +982,16 @@ def replace_event(self, event):
replace.replace(self.text, insert_tags="stdin")
return "break"

def pager(self, text):
"""pydoc.pager compatible callback for showing help() output."""
import pydoc # Import here to avoid i/o binding issues.
text = pydoc.plain(text) # Remove fancy pydoc formatting.
try:
title, text = text.split(':\n\n', 1)
except ValueError:
title = "Help"
view_text(self.text, title, text, modal=False)

def get_standard_extension_names(self):
return idleConf.GetExtensions(shell_only=True)

Expand Down
5 changes: 2 additions & 3 deletions 5 Lib/idlelib/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -530,9 +530,8 @@ def handle(self):
iomenu.encoding, "backslashreplace")

sys.displayhook = rpc.displayhook
# page help() text to shell.
import pydoc # import must be done here to capture i/o binding
pydoc.pager = pydoc.plainpager
import pydoc # import must be done here to capture i/o binding
pydoc.pager = self.console.pager

# Keep a reference to stdin so that it won't try to exit IDLE if
# sys.stdin gets changed from within IDLE's shell. See issue17838.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
``help(object)`` now shows the help text in a separate text viewing window
rather than in the shell output.
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.