Make pp bindings work with option in clipboard

If the clipboard contains "-a" then "open {clipboard}" will fail because
-a gets parsed as an option. "open -- {clipboard}" doesn't do that. See
some comments in #1791.
This commit is contained in:
Jan Verbeek 2016-08-16 14:00:37 +02:00
parent 5c766ff7da
commit 096387897c
2 changed files with 22 additions and 13 deletions

View File

@ -1524,12 +1524,12 @@ KEY_DATA = collections.OrderedDict([
('yank domain -s', ['yD']), ('yank domain -s', ['yD']),
('yank pretty-url', ['yp']), ('yank pretty-url', ['yp']),
('yank pretty-url -s', ['yP']), ('yank pretty-url -s', ['yP']),
('open {clipboard}', ['pp']), ('open -- {clipboard}', ['pp']),
('open {primary}', ['pP']), ('open -- {primary}', ['pP']),
('open -t {clipboard}', ['Pp']), ('open -t -- {clipboard}', ['Pp']),
('open -t {primary}', ['PP']), ('open -t -- {primary}', ['PP']),
('open -w {clipboard}', ['wp']), ('open -w -- {clipboard}', ['wp']),
('open -w {primary}', ['wP']), ('open -w -- {primary}', ['wP']),
('quickmark-save', ['m']), ('quickmark-save', ['m']),
('set-cmd-text -s :quickmark-load', ['b']), ('set-cmd-text -s :quickmark-load', ['b']),
('set-cmd-text -s :quickmark-load -t', ['B']), ('set-cmd-text -s :quickmark-load -t', ['B']),
@ -1699,11 +1699,16 @@ CHANGED_KEY_COMMANDS = [
(re.compile(r'^yank-selected -p'), r'yank selection -s'), (re.compile(r'^yank-selected -p'), r'yank selection -s'),
(re.compile(r'^yank-selected'), r'yank selection'), (re.compile(r'^yank-selected'), r'yank selection'),
(re.compile(r'^paste$'), r'open {clipboard}'), (re.compile(r'^paste$'), r'open -- {clipboard}'),
(re.compile(r'^paste -([twb])$'), r'open -\1 {clipboard}'), (re.compile(r'^paste -([twb])$'), r'open -\1 -- {clipboard}'),
(re.compile(r'^paste -([twb])s$'), r'open -\1 {primary}'), (re.compile(r'^paste -([twb])s$'), r'open -\1 -- {primary}'),
(re.compile(r'^paste -s([twb])$'), r'open -\1 {primary}'), (re.compile(r'^paste -s([twb])$'), r'open -\1 -- {primary}'),
(re.compile(r'^completion-item-next'), r'completion-item-focus next'), (re.compile(r'^completion-item-next'), r'completion-item-focus next'),
(re.compile(r'^completion-item-prev'), r'completion-item-focus prev'), (re.compile(r'^completion-item-prev'), r'completion-item-focus prev'),
(re.compile(r'^open {clipboard}$'), r'open -- {clipboard}'),
(re.compile(r'^open -([twb]) {clipboard}$'), r'open -\1 -- {clipboard}'),
(re.compile(r'^open {primary}$'), r'open -- {primary}'),
(re.compile(r'^open -([twb]) {primary}$'), r'open -\1 -- {primary}'),
] ]

View File

@ -299,9 +299,13 @@ class TestKeyConfigParser:
('yank -p', 'yank pretty-url'), ('yank -p', 'yank pretty-url'),
('yank -ps', 'yank pretty-url -s'), ('yank -ps', 'yank pretty-url -s'),
('paste', 'open {clipboard}'), ('paste', 'open -- {clipboard}'),
('paste -t', 'open -t {clipboard}'), ('paste -t', 'open -t -- {clipboard}'),
('paste -ws', 'open -w {primary}'), ('paste -ws', 'open -w -- {primary}'),
('open {clipboard}', 'open -- {clipboard}'),
('open -t {clipboard}', 'open -t -- {clipboard}'),
('open -b {primary}', 'open -b -- {primary}'),
] ]
) )
def test_migrations(self, old, new_expected): def test_migrations(self, old, new_expected):