summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorqweeze <g.fortunatov@bars-open.ru>2017-01-28 01:05:20 +0300
committerJonathan Slenders <jonathan@slenders.be>2017-01-28 12:31:29 +0100
commit6ed2477b9bea4aae017bdccc6aa69020dc900c33 (patch)
tree75c2f1d2b26e951b134a1a517e0d5bc7bc160490
parentd5d9e296cdd3e2b1e8126f6307a7c09d0bdcdd3a (diff)
Fix IndexError in operate-and-get-next command
-rw-r--r--prompt_toolkit/key_binding/bindings/named_commands.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/prompt_toolkit/key_binding/bindings/named_commands.py b/prompt_toolkit/key_binding/bindings/named_commands.py
index 668477be..5605f89b 100644
--- a/prompt_toolkit/key_binding/bindings/named_commands.py
+++ b/prompt_toolkit/key_binding/bindings/named_commands.py
@@ -561,7 +561,8 @@ def operate_and_get_next(event):
# Set the new index at the start of the next run.
def set_working_index():
- buff.working_index = new_index
+ if new_index < len(buff._working_lines):
+ buff.working_index = new_index
event.cli.pre_run_callables.append(set_working_index)