Remove :prompt-yes and :prompt-no

Those are replaced by :prompt-accept yes and :prompt-accept no
This commit is contained in:
Florian Bruhin 2016-09-09 15:57:15 +02:00
parent d579697245
commit d0cf452ec8
7 changed files with 28 additions and 27 deletions

View File

@ -112,7 +112,8 @@ Changed
- `content -> javascript-can-open-windows` got renamed to - `content -> javascript-can-open-windows` got renamed to
`javascript-can-open-windows-automatically`. `javascript-can-open-windows-automatically`.
- `:prompt-accept` now optionally accepts a value which overrides the one - `:prompt-accept` now optionally accepts a value which overrides the one
entered in the input box. entered in the input box. `yes` and `no` can be used as values for yes/no
questions.
Deprecated Deprecated
~~~~~~~~~~ ~~~~~~~~~~
@ -121,6 +122,8 @@ Deprecated
`{primary}` can be used instead. `{primary}` can be used instead.
- The `:paste-primary` command got deprecated as `:insert-text {primary}` can - The `:paste-primary` command got deprecated as `:insert-text {primary}` can
be used instead. be used instead.
- The `:prompt-yes` and `:prompt-no` commands got deprecated as
`:prompt-accept yes` and `:prompt-accept no` can be used instead.
Removed Removed
~~~~~~~ ~~~~~~~

View File

@ -974,9 +974,7 @@ How many steps to zoom out.
|<<move-to-start-of-prev-block,move-to-start-of-prev-block>>|Move the cursor or selection to the start of previous block. |<<move-to-start-of-prev-block,move-to-start-of-prev-block>>|Move the cursor or selection to the start of previous block.
|<<open-editor,open-editor>>|Open an external editor with the currently selected form field. |<<open-editor,open-editor>>|Open an external editor with the currently selected form field.
|<<prompt-accept,prompt-accept>>|Accept the current prompt. |<<prompt-accept,prompt-accept>>|Accept the current prompt.
|<<prompt-no,prompt-no>>|Answer no to a yes/no prompt.
|<<prompt-open-download,prompt-open-download>>|Immediately open a download. |<<prompt-open-download,prompt-open-download>>|Immediately open a download.
|<<prompt-yes,prompt-yes>>|Answer yes to a yes/no prompt.
|<<repeat-command,repeat-command>>|Repeat the last executed command. |<<repeat-command,repeat-command>>|Repeat the last executed command.
|<<rl-backward-char,rl-backward-char>>|Move back a character. |<<rl-backward-char,rl-backward-char>>|Move back a character.
|<<rl-backward-delete-char,rl-backward-delete-char>>|Delete the character before the cursor. |<<rl-backward-delete-char,rl-backward-delete-char>>|Delete the character before the cursor.
@ -1227,10 +1225,6 @@ Accept the current prompt.
* +'value'+: If given, uses this value instead of the entered one. For boolean prompts, "yes"/"no" are accepted as value. * +'value'+: If given, uses this value instead of the entered one. For boolean prompts, "yes"/"no" are accepted as value.
[[prompt-no]]
=== prompt-no
Answer no to a yes/no prompt.
[[prompt-open-download]] [[prompt-open-download]]
=== prompt-open-download === prompt-open-download
Syntax: +:prompt-open-download ['cmdline']+ Syntax: +:prompt-open-download ['cmdline']+
@ -1248,10 +1242,6 @@ If no specific command is given, this will use the system's default application
==== note ==== note
* This command does not split arguments after the last argument and handles quotes literally. * This command does not split arguments after the last argument and handles quotes literally.
[[prompt-yes]]
=== prompt-yes
Answer yes to a yes/no prompt.
[[repeat-command]] [[repeat-command]]
=== repeat-command === repeat-command
Repeat the last executed command. Repeat the last executed command.

View File

@ -1455,8 +1455,8 @@ KEY_SECTION_DESC = {
"bind special keys.\n" "bind special keys.\n"
"Useful hidden commands to map in this section:\n\n" "Useful hidden commands to map in this section:\n\n"
" * `prompt-accept`: Confirm the entered value.\n" " * `prompt-accept`: Confirm the entered value.\n"
" * `prompt-yes`: Answer yes to a yes/no question.\n" " * `prompt-accept yes`: Answer yes to a yes/no question.\n"
" * `prompt-no`: Answer no to a yes/no question."), " * `prompt-accept no`: Answer no to a yes/no question."),
'caret': ( 'caret': (
""), ""),
} }
@ -1631,8 +1631,8 @@ KEY_DATA = collections.OrderedDict([
('prompt', collections.OrderedDict([ ('prompt', collections.OrderedDict([
('prompt-accept', RETURN_KEYS), ('prompt-accept', RETURN_KEYS),
('prompt-yes', ['y']), ('prompt-accept yes', ['y']),
('prompt-no', ['n']), ('prompt-accept no', ['n']),
('prompt-open-download', ['<Ctrl-X>']), ('prompt-open-download', ['<Ctrl-X>']),
])), ])),
@ -1741,4 +1741,7 @@ CHANGED_KEY_COMMANDS = [
(re.compile(r'^set-cmd-text -s :search -r$'), r'set-cmd-text ?'), (re.compile(r'^set-cmd-text -s :search -r$'), r'set-cmd-text ?'),
(re.compile(r'^set-cmd-text -s :$'), r'set-cmd-text :'), (re.compile(r'^set-cmd-text -s :$'), r'set-cmd-text :'),
(re.compile(r'^set-cmd-text -s :set keybind$'), r'set-cmd-text -s :bind'), (re.compile(r'^set-cmd-text -s :set keybind$'), r'set-cmd-text -s :bind'),
(re.compile(r'^prompt-yes$'), r'prompt-accept yes'),
(re.compile(r'^prompt-no$'), r'prompt-accept no'),
] ]

View File

@ -304,7 +304,8 @@ class Prompter(QObject):
raise ValueError("Invalid question mode!") raise ValueError("Invalid question mode!")
@cmdutils.register(instance='prompter', hide=True, scope='window', @cmdutils.register(instance='prompter', hide=True, scope='window',
modes=[usertypes.KeyMode.yesno]) modes=[usertypes.KeyMode.yesno],
deprecated='Use :prompt-accept yes instead!')
def prompt_yes(self): def prompt_yes(self):
"""Answer yes to a yes/no prompt.""" """Answer yes to a yes/no prompt."""
if self._question.mode != usertypes.PromptMode.yesno: if self._question.mode != usertypes.PromptMode.yesno:
@ -316,7 +317,8 @@ class Prompter(QObject):
self._question.done() self._question.done()
@cmdutils.register(instance='prompter', hide=True, scope='window', @cmdutils.register(instance='prompter', hide=True, scope='window',
modes=[usertypes.KeyMode.yesno]) modes=[usertypes.KeyMode.yesno],
deprecated='Use :prompt-accept no instead!')
def prompt_no(self): def prompt_no(self):
"""Answer no to a yes/no prompt.""" """Answer no to a yes/no prompt."""
if self._question.mode != usertypes.PromptMode.yesno: if self._question.mode != usertypes.PromptMode.yesno:

View File

@ -23,14 +23,14 @@ Feature: Prompts
When I open data/prompt/jsconfirm.html When I open data/prompt/jsconfirm.html
And I run :click-element id button And I run :click-element id button
And I wait for a prompt And I wait for a prompt
And I run :prompt-yes And I run :prompt-accept yes
Then the javascript message "confirm reply: true" should be logged Then the javascript message "confirm reply: true" should be logged
Scenario: Javascript confirm - no Scenario: Javascript confirm - no
When I open data/prompt/jsconfirm.html When I open data/prompt/jsconfirm.html
And I run :click-element id button And I run :click-element id button
And I wait for a prompt And I wait for a prompt
And I run :prompt-no And I run :prompt-accept no
Then the javascript message "confirm reply: false" should be logged Then the javascript message "confirm reply: false" should be logged
Scenario: Javascript confirm - aborted Scenario: Javascript confirm - aborted
@ -101,7 +101,7 @@ Feature: Prompts
And I set network -> ssl-strict to ask And I set network -> ssl-strict to ask
And I load an SSL page And I load an SSL page
And I wait for a prompt And I wait for a prompt
And I run :prompt-yes And I run :prompt-accept yes
And I wait until the SSL page finished loading And I wait until the SSL page finished loading
Then the page should contain the plaintext "Hello World via SSL!" Then the page should contain the plaintext "Hello World via SSL!"
@ -110,7 +110,7 @@ Feature: Prompts
And I set network -> ssl-strict to ask And I set network -> ssl-strict to ask
And I load an SSL page And I load an SSL page
And I wait for a prompt And I wait for a prompt
And I run :prompt-no And I run :prompt-accept no
Then "Error while loading *: SSL handshake failed" should be logged Then "Error while loading *: SSL handshake failed" should be logged
And the page should contain the plaintext "Unable to load page" And the page should contain the plaintext "Unable to load page"
@ -135,7 +135,7 @@ Feature: Prompts
And I open data/prompt/geolocation.html in a new tab And I open data/prompt/geolocation.html in a new tab
And I run :click-element id button And I run :click-element id button
And I wait for a prompt And I wait for a prompt
And I run :prompt-yes And I run :prompt-accept yes
Then the javascript message "geolocation permission denied" should not be logged Then the javascript message "geolocation permission denied" should not be logged
Scenario: geolocation with ask -> false Scenario: geolocation with ask -> false
@ -143,7 +143,7 @@ Feature: Prompts
And I open data/prompt/geolocation.html in a new tab And I open data/prompt/geolocation.html in a new tab
And I run :click-element id button And I run :click-element id button
And I wait for a prompt And I wait for a prompt
And I run :prompt-no And I run :prompt-accept no
Then the javascript message "geolocation permission denied" should be logged Then the javascript message "geolocation permission denied" should be logged
Scenario: geolocation with ask -> abort Scenario: geolocation with ask -> abort
@ -173,7 +173,7 @@ Feature: Prompts
And I open data/prompt/notifications.html in a new tab And I open data/prompt/notifications.html in a new tab
And I run :click-element id button And I run :click-element id button
And I wait for a prompt And I wait for a prompt
And I run :prompt-no And I run :prompt-accept no
Then the javascript message "notification permission denied" should be logged Then the javascript message "notification permission denied" should be logged
Scenario: notifications with ask -> true Scenario: notifications with ask -> true
@ -181,7 +181,7 @@ Feature: Prompts
And I open data/prompt/notifications.html in a new tab And I open data/prompt/notifications.html in a new tab
And I run :click-element id button And I run :click-element id button
And I wait for a prompt And I wait for a prompt
And I run :prompt-yes And I run :prompt-accept yes
Then the javascript message "notification permission granted" should be logged Then the javascript message "notification permission granted" should be logged
# This actually gives us a denied rather than an aborted # This actually gives us a denied rather than an aborted

View File

@ -126,14 +126,14 @@ Feature: quickmarks and bookmarks
When I run :quickmark-add http://localhost:(port)/data/numbers/11.txt eleven When I run :quickmark-add http://localhost:(port)/data/numbers/11.txt eleven
And I run :quickmark-add http://localhost:(port)/data/numbers/11_2.txt eleven And I run :quickmark-add http://localhost:(port)/data/numbers/11_2.txt eleven
And I wait for "Entering mode KeyMode.yesno (reason: question asked)" in the log And I wait for "Entering mode KeyMode.yesno (reason: question asked)" in the log
And I run :prompt-no And I run :prompt-accept no
Then the quickmark file should contain "eleven http://localhost:*/data/numbers/11.txt" Then the quickmark file should contain "eleven http://localhost:*/data/numbers/11.txt"
Scenario: Saving a duplicate quickmark (with override) Scenario: Saving a duplicate quickmark (with override)
When I run :quickmark-add http://localhost:(port)/data/numbers/12.txt twelve When I run :quickmark-add http://localhost:(port)/data/numbers/12.txt twelve
And I run :quickmark-add http://localhost:(port)/data/numbers/12_2.txt twelve And I run :quickmark-add http://localhost:(port)/data/numbers/12_2.txt twelve
And I wait for "Entering mode KeyMode.yesno (reason: question asked)" in the log And I wait for "Entering mode KeyMode.yesno (reason: question asked)" in the log
And I run :prompt-yes And I run :prompt-accept yes
Then the quickmark file should contain "twelve http://localhost:*/data/numbers/12_2.txt" Then the quickmark file should contain "twelve http://localhost:*/data/numbers/12_2.txt"
Scenario: Adding a quickmark with an empty name Scenario: Adding a quickmark with an empty name

View File

@ -345,6 +345,9 @@ class TestKeyConfigParser:
('set-cmd-text -s :search -r', 'set-cmd-text ?'), ('set-cmd-text -s :search -r', 'set-cmd-text ?'),
('set-cmd-text -s :', 'set-cmd-text :'), ('set-cmd-text -s :', 'set-cmd-text :'),
('set-cmd-text -s :set keybind', 'set-cmd-text -s :bind'), ('set-cmd-text -s :set keybind', 'set-cmd-text -s :bind'),
('prompt-yes', 'prompt-accept yes'),
('prompt-no', 'prompt-accept no'),
] ]
) )
def test_migrations(self, old, new_expected): def test_migrations(self, old, new_expected):