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

Commit 89f73ea

Browse filesBrowse files
remove duplicate keys in process_event, fmtstr version bump
keys are getting turned into their curses equivalents, so no need to hardcode control sequences for shift-tab etc Also stop hardcoding ctrl-r for undo, F8 for pastebin etc. to respect user config --HG-- branch : scroll-frontend extra : amend_source : a6e17cb17177e30e0e9ccfbe8f94ca67cf21ace1
1 parent 9f98317 commit 89f73ea
Copy full SHA for 89f73ea

2 files changed

+14-15Lines changed: 14 additions & 15 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎bpython/scrollfrontend/repl.py‎

Copy file name to clipboardExpand all lines: bpython/scrollfrontend/repl.py
+13-14Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,12 @@
3434

3535
#TODO implement paste mode and figure out what the deal with config.paste_time is
3636
#TODO figure out how config.auto_display_list=False behaves and implement it
37-
#TODO figure out how config.list_win_visible behaves and implement it
38-
#TODO other autocomplete modes
37+
#TODO figure out how config.list_win_visible behaves and implement it, or toss
38+
#TODO other autocomplete modes (also fix in other bpython implementations)
3939
#TODO figure out what config.flush_output is
4040
#TODO figure out what options.quiet is
41-
#TODO execute file if in args
42-
#TODO proper raw_input (currently input isn't visible while typing, includes \r, and comes in as unicode in Python 2
4341
#TODO use events instead of length-one queues for interthread communication
4442

45-
#TODO check py3 compatibility
46-
4743

4844
from bpython.keys import cli_key_dispatch as key_dispatch
4945

@@ -252,6 +248,8 @@ def clean_up_current_line_for_exit(self):
252248
## Event handling
253249
def process_event(self, e):
254250
"""Returns True if shutting down, otherwise mutates state of Repl object"""
251+
# event names uses here are curses compatible, or the full names
252+
# for a full list of what should have pretty names, see fmtstr.events.CURSES_TABLE
255253

256254
if not isinstance(e, events.Event):
257255
self.last_events.append(e)
@@ -281,12 +279,12 @@ def process_event(self, e):
281279
self.update_completion()
282280

283281
# readline history commands
284-
elif e in ("[A", "KEY_UP") + key_dispatch[self.config.up_one_line_key]:
282+
elif e in ("KEY_UP",) + key_dispatch[self.config.up_one_line_key]:
285283
self.rl_history.enter(self._current_line)
286284
self._current_line = self.rl_history.back(False)
287285
self.cursor_offset_in_line = len(self._current_line)
288286
self.update_completion()
289-
elif e in ("[B", "KEY_DOWN") + key_dispatch[self.config.down_one_line_key]:
287+
elif e in ("KEY_DOWN",) + key_dispatch[self.config.down_one_line_key]:
290288
self.rl_history.enter(self._current_line)
291289
self._current_line = self.rl_history.forward(False)
292290
self.cursor_offset_in_line = len(self._current_line)
@@ -320,18 +318,18 @@ def process_event(self, e):
320318
#TODO use a whitelist instead of a blacklist!
321319
elif e == '\t': # tab
322320
self.on_tab()
323-
elif e in ('[Z', "KEY_BTAB"): # shift-tab
321+
elif e in ("KEY_BTAB",): # shift-tab
324322
self.on_tab(back=True)
325-
elif e in ('',) + key_dispatch[self.config.undo_key]:
323+
elif e in key_dispatch[self.config.undo_key]: #ctrl-r for undo
326324
self.undo()
327-
elif e in ('\x13',) + key_dispatch[self.config.save_key]: # ctrl-s for save
325+
elif e in key_dispatch[self.config.save_key]: # ctrl-s for save
328326
t = threading.Thread(target=self.write2file)
329327
t.daemon = True
330328
logging.debug('starting write2file thread')
331329
t.start()
332330
self.interact.wait_for_request_or_notify()
333331
# F8 for pastebin
334-
elif e in ('\x1b[19~',) + key_dispatch[self.config.pastebin_key]:
332+
elif e in key_dispatch[self.config.pastebin_key]:
335333
t = threading.Thread(target=self.pastebin)
336334
t.daemon = True
337335
logging.debug('starting pastebin thread')
@@ -853,8 +851,9 @@ def reevaluate(self, insert_into_history=False):
853851

854852
def getstdout(self):
855853
lines = self.lines_for_display + [self.current_line_formatted]
856-
s = '\n'.join(['%simport %s' % (self.ps1, name) for name in self.interp.locals.autoimported] if self.config.scroll_auto_import else [] +
857-
[x.s if isinstance(x, FmtStr) else x for x in lines]
854+
imports = (['%simport %s' % (self.ps1, name) for name in self.interp.locals.autoimported]
855+
if hasattr(self.interp.locals, 'autoimported') else [])
856+
s = '\n'.join(imports + [x.s if isinstance(x, FmtStr) else x for x in lines]
858857
) if lines else ''
859858
return s
860859
def send_to_external_editor(self, filename=None):
Collapse file

‎setup.py‎

Copy file name to clipboardExpand all lines: setup.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ def initialize_options(self):
153153
'pygments'
154154
],
155155
extras_require = {
156-
'scroll': ['fmtstr>=0.0.17'],
156+
'scroll': ['fmtstr>=0.0.18'],
157157
'urwid' : ['urwid']
158158
},
159159
tests_require = ['mock'],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.