aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mitmproxy/tools/console/defaultkeys.py2
-rw-r--r--mitmproxy/tools/console/eventlog.py8
-rw-r--r--mitmproxy/tools/console/keymap.py1
-rw-r--r--mitmproxy/tools/console/master.py7
-rw-r--r--mitmproxy/tools/console/overlay.py2
-rw-r--r--mitmproxy/tools/console/signals.py5
6 files changed, 19 insertions, 6 deletions
diff --git a/mitmproxy/tools/console/defaultkeys.py b/mitmproxy/tools/console/defaultkeys.py
index 2dc0e344..d5b868d0 100644
--- a/mitmproxy/tools/console/defaultkeys.py
+++ b/mitmproxy/tools/console/defaultkeys.py
@@ -135,3 +135,5 @@ def map(km):
"Read a Python-style escaped string from file"
)
km.add("e", "console.grideditor.editor", ["grideditor"], "Edit in external editor")
+
+ km.add("z", "console.eventlog.clear", ["eventlog"], "Clear")
diff --git a/mitmproxy/tools/console/eventlog.py b/mitmproxy/tools/console/eventlog.py
index 1e56a05a..5fdada9f 100644
--- a/mitmproxy/tools/console/eventlog.py
+++ b/mitmproxy/tools/console/eventlog.py
@@ -18,16 +18,14 @@ class EventLog(urwid.ListBox, layoutwidget.LayoutWidget):
self.master = master
urwid.ListBox.__init__(self, self.walker)
signals.sig_add_log.connect(self.sig_add_log)
+ signals.sig_clear_log.connect(self.sig_clear_log)
def set_focus(self, index):
if 0 <= index < len(self.walker):
super().set_focus(index)
def keypress(self, size, key):
- if key == "z":
- self.clear_events()
- key = None
- elif key == "m_end":
+ if key == "m_end":
self.set_focus(len(self.walker) - 1)
elif key == "m_start":
self.set_focus(0)
@@ -45,5 +43,5 @@ class EventLog(urwid.ListBox, layoutwidget.LayoutWidget):
if self.master.options.console_focus_follow:
self.walker.set_focus(len(self.walker) - 1)
- def clear_events(self):
+ def sig_clear_log(self, sender):
self.walker[:] = []
diff --git a/mitmproxy/tools/console/keymap.py b/mitmproxy/tools/console/keymap.py
index 343c46a6..b904f706 100644
--- a/mitmproxy/tools/console/keymap.py
+++ b/mitmproxy/tools/console/keymap.py
@@ -6,6 +6,7 @@ from mitmproxy.tools.console import commandeditor
SupportedContexts = {
"chooser",
"commands",
+ "eventlog",
"flowlist",
"flowview",
"global",
diff --git a/mitmproxy/tools/console/master.py b/mitmproxy/tools/console/master.py
index d2575145..ce4e4d9d 100644
--- a/mitmproxy/tools/console/master.py
+++ b/mitmproxy/tools/console/master.py
@@ -426,6 +426,13 @@ class ConsoleAddon:
]
)
+ @command.command("console.eventlog.clear")
+ def eventlog_clear(self) -> None:
+ """
+ Clear the event log.
+ """
+ signals.sig_clear_log.send(self)
+
def running(self):
self.started = True
diff --git a/mitmproxy/tools/console/overlay.py b/mitmproxy/tools/console/overlay.py
index 5a82a54b..7072d00e 100644
--- a/mitmproxy/tools/console/overlay.py
+++ b/mitmproxy/tools/console/overlay.py
@@ -118,6 +118,8 @@ class Chooser(urwid.WidgetWrap, layoutwidget.LayoutWidget):
if key == "m_select":
self.callback(self.choices[self.walker.index])
signals.pop_view_state.send(self)
+ elif key == "esc":
+ signals.pop_view_state.send(self)
return super().keypress(size, key)
diff --git a/mitmproxy/tools/console/signals.py b/mitmproxy/tools/console/signals.py
index 2c09c708..49115a5d 100644
--- a/mitmproxy/tools/console/signals.py
+++ b/mitmproxy/tools/console/signals.py
@@ -1,6 +1,9 @@
import blinker
-# Show a status message in the action bar
+# Clear the eventlog
+sig_clear_log = blinker.Signal()
+
+# Add an entry to the eventlog
sig_add_log = blinker.Signal()