Remove trailing backslashes to avoid breaking shlex that is used to split parameters passed to commands

This commit is contained in:
Asmageddon 2012-03-07 15:24:26 +01:00
parent f5c8968aa6
commit 98c9aaf600
1 changed files with 7 additions and 1 deletions

View File

@ -120,6 +120,9 @@ class Legacy(BaseMode):
# We clear the input string and send it to the command parser on ENTER
if c == curses.KEY_ENTER or c == 10:
if self.input:
if self.input.endswith('\\'):
self.input = self.input[:-1]
self.input_cursor -= 1
self.add_line(">>> " + self.input)
self.do_command(self.input.encode(self.encoding))
if len(self.input_history) == INPUT_HISTORY_SIZE:
@ -594,6 +597,10 @@ class Legacy(BaseMode):
else:
empty = False
#Remove dangling backslashes to avoid breaking shlex
if line.endswith("\\"):
line = line[:-1]
raw_line = line
line = line.replace("\\ ", " ")
@ -628,7 +635,6 @@ class Legacy(BaseMode):
if torrent_name.startswith(line):
text = "{!info!}%s{!input!}%s ({!cyan!}%s{!input!})" % (escaped_name[:l], escaped_name[l:], torrent_id)
possible_matches.append(text)
return possible_matches
def get_torrent_name(self, torrent_id):