Make tab completion behave more like bash
authorJack Miller <millerjo@us.ibm.com>
Mon, 1 Jun 2015 16:27:49 +0000 (11:27 -0500)
committerJack Miller <millerjo@us.ibm.com>
Mon, 1 Jun 2015 16:27:49 +0000 (11:27 -0500)
In terms of cursor position, and behavior when you start doing stuff
other than hitting tab.

canto_curses/input.py
canto_curses/screen.py

index 19f8129..e2bb3ef 100644 (file)
@@ -95,7 +95,6 @@ class InputBox(GuiBase):
             pass
         self.x = self.pad.getyx()[1]
         self.pad.clrtoeol()
-        self.pad.move(0, self.minx + get_rlpoint())
         self.callbacks["refresh"]()
 
     def redraw(self):
index c2d6382..c4e3b04 100644 (file)
@@ -599,16 +599,10 @@ class Screen(CommandHandler):
             self.input_box.rotate_completions()
             return
 
-        # Accept current completion
-        if chr(r) in " \b\n" and do_comp:
-            comp = self.input_box.break_completion()
-            if comp:
-                log.debug("inserting: %s" % comp)
-                readline.insert_text(comp)
-
-        # Discard current completion
-        else:
-            self.input_box.break_completion()
+        comp = self.input_box.break_completion()
+        if comp:
+            log.debug("inserting: %s" % comp)
+            readline.insert_text(comp)
 
         log.debug("KEY: %s" % r)
         return r