Fix completing empty command lines
authorJack Miller <jack@codezen.org>
Wed, 1 Jun 2016 03:16:35 +0000 (22:16 -0500)
committerJack Miller <jack@codezen.org>
Wed, 1 Jun 2016 03:16:35 +0000 (22:16 -0500)
Closes #37

canto_curses/input.py

index ad78f45..68ba20c 100644 (file)
@@ -47,7 +47,7 @@ class InputBox(GuiBase):
 
     def _get_prefix(self):
         buf = readline.get_line_buffer()
-        if buf[-1].isspace():
+        if (not buf) or buf[-1].isspace():
             prefix = ""
         else:
             prefix = shlex.split(buf)[-1]