summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2017-10-25 11:26:03 +0800
committerMaxime Coste <mawww@kakoune.org>2017-10-25 11:26:03 +0800
commit75767f5cb5189e72225e6a84cd578aed328bcb90 (patch)
tree3a540dae45c3d3b7f564c17e2db21dc6a00222b8 /src
parentab9283bc371cb341846a751cb215234e9e4ff6c2 (diff)
Fix infinite loop shell_complete
Fixes #1648
Diffstat (limited to 'src')
-rw-r--r--src/completion.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/completion.cc b/src/completion.cc
index e85d5fe1..e5a664b0 100644
--- a/src/completion.cc
+++ b/src/completion.cc
@@ -14,7 +14,7 @@ Completions shell_complete(const Context& context, CompletionFlags flags,
bool command = true;
const ByteCount len = prefix.length();
- for (ByteCount pos = 0; pos < cursor_pos;)
+ for (ByteCount pos = 0; pos < cursor_pos and pos < len;)
{
command = (pos == 0 or prefix[pos-1] == ';' or prefix[pos-1] == '|' or
(pos > 1 and prefix[pos-1] == '&' and prefix[pos-2] == '&'));