do not fail when there is no completion in emacs mode

Ignore-this: d816c80746b598514f88d6251c8498ae

darcs-hash:20110731164250-c41ad-fd390559494714e025e54bfff2273d18e27b470a
This commit is contained in:
Jeremie Dimino 2011-07-31 18:42:50 +02:00
parent ca976c49c8
commit 344fa5d9a9
1 changed files with 6 additions and 1 deletions

View File

@ -139,7 +139,12 @@ and process prompt buffer length command argument =
let words = List.map fst words in
let prefix = LTerm_read_line.common_prefix words in
let index = String.length input - start in
let suffix = String.sub prefix index (String.length prefix - index) in
let suffix =
if index > 0 && index <= String.length prefix then
String.sub prefix index (String.length prefix - index)
else
""
in
if suffix = "" then begin
send "completion-start" "";
List.iter (fun word -> send "completion" word) words;