Remove trailing backslashes to avoid breaking shlex that is used to split parameters passed to commands
This commit is contained in:
parent
f5c8968aa6
commit
98c9aaf600
|
@ -120,6 +120,9 @@ class Legacy(BaseMode):
|
||||||
# We clear the input string and send it to the command parser on ENTER
|
# We clear the input string and send it to the command parser on ENTER
|
||||||
if c == curses.KEY_ENTER or c == 10:
|
if c == curses.KEY_ENTER or c == 10:
|
||||||
if self.input:
|
if self.input:
|
||||||
|
if self.input.endswith('\\'):
|
||||||
|
self.input = self.input[:-1]
|
||||||
|
self.input_cursor -= 1
|
||||||
self.add_line(">>> " + self.input)
|
self.add_line(">>> " + self.input)
|
||||||
self.do_command(self.input.encode(self.encoding))
|
self.do_command(self.input.encode(self.encoding))
|
||||||
if len(self.input_history) == INPUT_HISTORY_SIZE:
|
if len(self.input_history) == INPUT_HISTORY_SIZE:
|
||||||
|
@ -594,6 +597,10 @@ class Legacy(BaseMode):
|
||||||
else:
|
else:
|
||||||
empty = False
|
empty = False
|
||||||
|
|
||||||
|
#Remove dangling backslashes to avoid breaking shlex
|
||||||
|
if line.endswith("\\"):
|
||||||
|
line = line[:-1]
|
||||||
|
|
||||||
raw_line = line
|
raw_line = line
|
||||||
line = line.replace("\\ ", " ")
|
line = line.replace("\\ ", " ")
|
||||||
|
|
||||||
|
@ -628,7 +635,6 @@ class Legacy(BaseMode):
|
||||||
if torrent_name.startswith(line):
|
if torrent_name.startswith(line):
|
||||||
text = "{!info!}%s{!input!}%s ({!cyan!}%s{!input!})" % (escaped_name[:l], escaped_name[l:], torrent_id)
|
text = "{!info!}%s{!input!}%s ({!cyan!}%s{!input!})" % (escaped_name[:l], escaped_name[l:], torrent_id)
|
||||||
possible_matches.append(text)
|
possible_matches.append(text)
|
||||||
|
|
||||||
return possible_matches
|
return possible_matches
|
||||||
|
|
||||||
def get_torrent_name(self, torrent_id):
|
def get_torrent_name(self, torrent_id):
|
||||||
|
|
Loading…
Reference in New Issue