Fix some corner cases with :set.
This commit is contained in:
parent
a26e99f004
commit
54e2cea460
@ -84,7 +84,8 @@ Fixed
|
||||
- Fixed a crash when a website presents a very small favicon.
|
||||
- Fixed prompting for download directory when
|
||||
`storage -> prompt-download-directory` was unset.
|
||||
- Fixed crash when using `:follow-hint outside of hint mode.
|
||||
- Fixed crash when using `:follow-hint` outside of hint mode.
|
||||
- Fixed crash when using `:set foo bar?` with invalid section/option.
|
||||
|
||||
v0.4.1
|
||||
------
|
||||
|
@ -699,12 +699,12 @@ class ConfigManager(QObject):
|
||||
tabbed_browser.openurl(QUrl('qute:settings'), newtab=False)
|
||||
return
|
||||
|
||||
if option.endswith('?'):
|
||||
if option.endswith('?') and option != '?':
|
||||
option = option[:-1]
|
||||
print_ = True
|
||||
else:
|
||||
try:
|
||||
if option.endswith('!') and value is None:
|
||||
if option.endswith('!') and option != '!' and value is None:
|
||||
option = option[:-1]
|
||||
val = self.get(section_, option)
|
||||
layer = 'temp' if temp else 'conf'
|
||||
@ -724,7 +724,11 @@ class ConfigManager(QObject):
|
||||
e.__class__.__name__, e))
|
||||
|
||||
if print_:
|
||||
val = self.get(section_, option, transformed=False)
|
||||
try:
|
||||
val = self.get(section_, option, transformed=False)
|
||||
except configexc.Error as e:
|
||||
raise cmdexc.CommandError("set: {} - {}".format(
|
||||
e.__class__.__name__, e))
|
||||
message.info(win_id, "{} {} = {}".format(
|
||||
section_, option, val), immediately=True)
|
||||
|
||||
|
@ -41,6 +41,11 @@ Feature: Setting settings.
|
||||
When I run :set -p colors statusbar.bg red
|
||||
Then the message "colors statusbar.bg = red" should be shown.
|
||||
|
||||
Scenario: Using ! and -p
|
||||
When I run :set general auto-save-config false
|
||||
And I run :set -p general auto-save-config!
|
||||
Then the message "general auto-save-config = True" should be shown.
|
||||
|
||||
Scenario: Setting a temporary option
|
||||
# We don't actually check if the option is temporary as this isn't easy
|
||||
# to check.
|
||||
@ -58,3 +63,35 @@ Feature: Setting settings.
|
||||
- url: about:blank
|
||||
- active: true
|
||||
url: qute:settings
|
||||
|
||||
Scenario: Empty option with ? (issue 1109)
|
||||
When I run :set general ?
|
||||
Then the error "set: The following arguments are required: value" should be shown.
|
||||
|
||||
Scenario: Invalid section and empty option with ? (issue 1109)
|
||||
When I run :set blah ?
|
||||
Then the error "set: The following arguments are required: value" should be shown.
|
||||
|
||||
Scenario: Invalid option with ? (issue 1109)
|
||||
When I run :set general foo?
|
||||
Then the error "set: NoOptionError - No option 'foo' in section 'general'" should be shown.
|
||||
|
||||
Scenario: Invalid section/option with ? (issue 1109)
|
||||
When I run :set blah foo ?
|
||||
Then the error "set: NoSectionError - Section 'blah' does not exist!" should be shown.
|
||||
|
||||
Scenario: Empty option with !
|
||||
When I run :set general !
|
||||
Then the error "set: The following arguments are required: value" should be shown.
|
||||
|
||||
Scenario: Invalid section and empty option with !
|
||||
When I run :set blah !
|
||||
Then the error "set: The following arguments are required: value" should be shown.
|
||||
|
||||
Scenario: Invalid option with !
|
||||
When I run :set general foo!
|
||||
Then the error "set: NoOptionError - No option 'foo' in section 'general'" should be shown.
|
||||
|
||||
Scenario: Invalid section/option with !
|
||||
When I run :set blah foo !
|
||||
Then the error "set: NoSectionError - Section 'blah' does not exist!" should be shown.
|
||||
|
Loading…
Reference in New Issue
Block a user