mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-08 09:28:41 +00:00
use os.path.commonprefix to do better completion
This commit is contained in:
parent
7f52472e9e
commit
543fcf722c
1 changed files with 7 additions and 1 deletions
|
@ -469,7 +469,13 @@ class TextInput(InputField):
|
||||||
self.value = opts[0]
|
self.value = opts[0]
|
||||||
self.cursor = len(opts[0])
|
self.cursor = len(opts[0])
|
||||||
self.tab_count = 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)
|
self.opts = " ".join(opts)
|
||||||
|
|
||||||
# Cursor movement
|
# Cursor movement
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue