Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ab2dc06

Browse files
committed
use Escape to clear docstrings
it takes a while to kick in (half a second?), but better than nothing. This will be particularly useful for when the tooltip is above the input line and is blocking the last set of outputs
1 parent 87a5559 commit ab2dc06

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

bipython/__init__.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,10 @@ def _populate_completion(self):
11711171
def _populate_docstring(self):
11721172
"Make visible the docstring"
11731173
self.docstring_widget.set_text(('comment', self.docstring))
1174+
1175+
def clear_docstring(self):
1176+
"remove the docstring"
1177+
self.docstring_widget.set_text('')
11741178

11751179
def reprint_line(self, lineno, tokens):
11761180
edit = self.edits[-len(self.buffer) + lineno - 1]
@@ -1667,8 +1671,10 @@ def handle_input(self, event):
16671671
self.tab()
16681672
elif urwid.command_map[event] == 'prev selectable':
16691673
self.tab(True)
1670-
#else:
1671-
# self.echo(repr(event))
1674+
elif event == 'esc':
1675+
self.clear_docstring() # why is this so slow?, ARGH!
1676+
else:
1677+
self.echo(repr(event))
16721678

16731679
def tab(self, back=False):
16741680
"""Process the tab key being hit.

0 commit comments

Comments
 (0)