[commands] Minor optimisations to unicode quote handling.
This commit is contained in:
parent
ea061ef9b2
commit
d8a85f4898
@ -143,8 +143,11 @@ def quoted_word(view):
|
|||||||
close_quote = _quotes.get(current)
|
close_quote = _quotes.get(current)
|
||||||
is_quoted = bool(close_quote)
|
is_quoted = bool(close_quote)
|
||||||
if is_quoted:
|
if is_quoted:
|
||||||
open_quote = current
|
result = []
|
||||||
result = [] if is_quoted else [current]
|
_escaped_quotes = (current, close_quote)
|
||||||
|
else:
|
||||||
|
result = [current]
|
||||||
|
_escaped_quotes = _all_quotes
|
||||||
|
|
||||||
while not view.eof:
|
while not view.eof:
|
||||||
current = view.get()
|
current = view.get()
|
||||||
@ -166,7 +169,7 @@ def quoted_word(view):
|
|||||||
# if we aren't then we just let it through
|
# if we aren't then we just let it through
|
||||||
return ''.join(result)
|
return ''.join(result)
|
||||||
|
|
||||||
if next_char in ((open_quote, close_quote) if is_quoted else _all_quotes):
|
if next_char in _escaped_quotes:
|
||||||
# escaped quote
|
# escaped quote
|
||||||
result.append(next_char)
|
result.append(next_char)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user