From 508dec4858c4828dd74e5edd1cf6db12d97dd0c3 Mon Sep 17 00:00:00 2001 From: Asmageddon Date: Sun, 4 Mar 2012 15:25:27 +0100 Subject: [PATCH] Modified autocompletion to only list a limited amount of matches(use info for full list), color coded it, modified to show both torrent names and ID as well as highlight matching part, show green 'Autocompletion matches' text for more than 4 matches so it's more readable. Depends on previous commit --- deluge/ui/console/modes/legacy.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/deluge/ui/console/modes/legacy.py b/deluge/ui/console/modes/legacy.py index 5b46acbad..a872356e4 100644 --- a/deluge/ui/console/modes/legacy.py +++ b/deluge/ui/console/modes/legacy.py @@ -57,6 +57,9 @@ import re LINES_BUFFER_SIZE = 5000 INPUT_HISTORY_SIZE = 500 +AUTOCOMPLETE_MAX_TORRENTS = 20 +AUTOCOMPLETE_MAX_TORRENTS_WITH_PATTERN = 10 + class Legacy(BaseMode): def __init__(self, stdscr, console_config, encoding=None): @@ -631,10 +634,11 @@ class Legacy(BaseMode): #If we only matched one torrent, don't add the full name or it'll also get autocompleted if match_count == 1: if torrent_id.startswith(line): - possible_matches.append(torrent_id + " ") + possible_matches.append(torrent_id) break if torrent_name.startswith(line): - possible_matches.append(escaped_name + " ") + self.write(escaped_name) + possible_matches.append(escaped_name) break else: l = len(raw_line)