Module: deluge
Branch: master
Commit: 543fcf722c3800f3803a785a012277b794138169

Author: Nick Lanham <[email protected]>
Date:   Tue Feb 22 14:58:40 2011 +0100

use os.path.commonprefix to do better completion

---

 deluge/ui/console/modes/input_popup.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/deluge/ui/console/modes/input_popup.py 
b/deluge/ui/console/modes/input_popup.py
index 183d33d..6a0f3f5 100644
--- a/deluge/ui/console/modes/input_popup.py
+++ b/deluge/ui/console/modes/input_popup.py
@@ -469,7 +469,13 @@ class TextInput(InputField):
                         self.value = opts[0]
                         self.cursor = len(opts[0])
                         self.tab_count = 0
-                    elif len(opts) > 1 and second_hit: # display multiple 
options on second tab hit
+                    elif len(opts) > 1:
+                        prefix = os.path.commonprefix(opts)
+                        if prefix:
+                            self.value = prefix
+                            self.cursor = len(prefix)
+
+                    if len(opts) > 1 and second_hit: # display multiple 
options on second tab hit
                         self.opts = "  ".join(opts)
 
         # Cursor movement

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to