Quote a completed value if it contains "
This commit is contained in:
parent
a7d5a98cc4
commit
4f6e085be8
@ -111,7 +111,7 @@ class Completer(QObject):
|
|||||||
"""
|
"""
|
||||||
if not s:
|
if not s:
|
||||||
return "''"
|
return "''"
|
||||||
elif any(c in s for c in ' \'\t\n\\'):
|
elif any(c in s for c in ' "\'\t\n\\'):
|
||||||
# use single quotes, and put single quotes into double quotes
|
# use single quotes, and put single quotes into double quotes
|
||||||
# the string $'b is then quoted as '$'"'"'b'
|
# the string $'b is then quoted as '$'"'"'b'
|
||||||
return "'" + s.replace("'", "'\"'\"'") + "'"
|
return "'" + s.replace("'", "'\"'\"'") + "'"
|
||||||
|
@ -240,6 +240,10 @@ def test_update_completion(txt, kind, pattern, pos_args, status_command_stub,
|
|||||||
":set fonts hints '12px Hack'|"),
|
":set fonts hints '12px Hack'|"),
|
||||||
(":set fonts hints 'Comic| Sans'", '12px Hack',
|
(":set fonts hints 'Comic| Sans'", '12px Hack',
|
||||||
":set fonts hints '12px Hack'|"),
|
":set fonts hints '12px Hack'|"),
|
||||||
|
# Make sure " is quoted properly
|
||||||
|
(':set url.start_pages \'["https://www.|example.com"]\'',
|
||||||
|
'["https://www.example.org"]',
|
||||||
|
':set url.start_pages \'["https://www.example.org"]\'|'),
|
||||||
# open has maxsplit=0, so treat the last two tokens as one and don't quote
|
# open has maxsplit=0, so treat the last two tokens as one and don't quote
|
||||||
(':open foo bar|', 'baz', ':open baz|'),
|
(':open foo bar|', 'baz', ':open baz|'),
|
||||||
(':open foo| bar', 'baz', ':open baz|'),
|
(':open foo| bar', 'baz', ':open baz|'),
|
||||||
|
Loading…
Reference in New Issue
Block a user