Skip to content

Commit

Permalink
fix #21 crash on empty history with empty prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
imomaliev committed Jan 22, 2019
1 parent dd485e3 commit 7582c9d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion ptrepl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
"""


__version__ = '0.9.5'
__version__ = '0.9.6'
9 changes: 5 additions & 4 deletions ptrepl/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,18 @@ def main(command, prompt=None):
)
subcommand = session.prompt(_get_prompt_tokens)
try:
subcommand, execute = expand_history(
expanded_subcommand, execute = expand_history(
subcommand, session.default_buffer.history.get_strings()
)
except BashHistoryIndexError as e:
print(f'{command}: {e}: event not found')
continue
if not execute:
print(subcommand)
print(expanded_subcommand)
continue
session.default_buffer.history.get_strings()[-1] = subcommand
subcommand = completer.get_real_subcommand(subcommand)
if subcommand != expanded_subcommand:
session.default_buffer.history.get_strings()[-1] = expanded_subcommand
subcommand = completer.get_real_subcommand(expanded_subcommand)
if subcommand is None:
break

Expand Down

0 comments on commit 7582c9d

Please sign in to comment.