aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@corte.si>2018-05-26 10:51:24 +1200
committerGitHub <noreply@github.com>2018-05-26 10:51:24 +1200
commit8a76970944e8f51ba21325bac2d170803730f440 (patch)
treed4f0555f5d702fe5e14a0770bf19ab996aecaec3
parent7991c9e9b41bc1dcefbcdefdbe83cc61f58f30a8 (diff)
parentbd7069a9e09f8c07add66576b165095acce4dea5 (diff)
downloadmitmproxy-8a76970944e8f51ba21325bac2d170803730f440.tar.gz
mitmproxy-8a76970944e8f51ba21325bac2d170803730f440.tar.bz2
mitmproxy-8a76970944e8f51ba21325bac2d170803730f440.zip
Merge pull request #3157 from gcmurphy/issue/3147
Adjust options when changed
-rw-r--r--mitmproxy/optmanager.py1
-rw-r--r--mitmproxy/tools/console/options.py2
2 files changed, 3 insertions, 0 deletions
diff --git a/mitmproxy/optmanager.py b/mitmproxy/optmanager.py
index a473e9df..2a4beba9 100644
--- a/mitmproxy/optmanager.py
+++ b/mitmproxy/optmanager.py
@@ -107,6 +107,7 @@ class OptManager:
choices: typing.Optional[typing.Sequence[str]] = None
) -> None:
self._options[name] = _Option(name, typespec, default, help, choices)
+ self.changed.send(self, updated={name})
@contextlib.contextmanager
def rollback(self, updated, reraise=False):
diff --git a/mitmproxy/tools/console/options.py b/mitmproxy/tools/console/options.py
index 54772cf0..6e1399ce 100644
--- a/mitmproxy/tools/console/options.py
+++ b/mitmproxy/tools/console/options.py
@@ -106,6 +106,8 @@ class OptionListWalker(urwid.ListWalker):
self.master.options.changed.connect(self.sig_mod)
def sig_mod(self, *args, **kwargs):
+ self.opts = sorted(self.master.options.keys())
+ self.maxlen = max(len(i) for i in self.opts)
self._modified()
self.set_focus(self.index)