diff --git a/mitmproxy/tools/console/flowview.py b/mitmproxy/tools/console/flowview.py index 90cca1c5a..ba41c947f 100644 --- a/mitmproxy/tools/console/flowview.py +++ b/mitmproxy/tools/console/flowview.py @@ -15,6 +15,7 @@ from mitmproxy.net.http import status_codes from mitmproxy.tools.console import common from mitmproxy.tools.console import flowdetailview from mitmproxy.tools.console import grideditor +from mitmproxy.tools.console import overlay from mitmproxy.tools.console import searchable from mitmproxy.tools.console import signals from mitmproxy.tools.console import tabs @@ -237,11 +238,10 @@ class FlowView(tabs.Tabs): return description, text_objects def viewmode_get(self): - override = self.view.settings[self.flow].get( + return self.view.settings[self.flow].get( (self.tab_offset, "prettyview"), - None + self.master.options.default_contentview ) - return self.master.options.default_contentview if override is None else override def conn_text(self, conn): if conn: @@ -483,11 +483,8 @@ class FlowView(tabs.Tabs): return self._view_nextprev_flow(self.view.index(flow) - 1, flow) def change_this_display_mode(self, t): - view = contentviews.get_by_shortcut(t) - if view: - self.view.settings[self.flow][(self.tab_offset, "prettyview")] = view.name - else: - self.view.settings[self.flow][(self.tab_offset, "prettyview")] = None + view = contentviews.get(t) + self.view.settings[self.flow][(self.tab_offset, "prettyview")] = view.name.lower() signals.flow_change.send(self, flow=self.flow) def keypress(self, size, key): @@ -607,13 +604,14 @@ class FlowView(tabs.Tabs): signals.flow_change.send(self, flow = self.flow) signals.status_message.send(message="Loading all body data...") elif key == "m": - p = list(contentviews.view_prompts) - p.insert(0, ("Clear", "C")) - signals.status_prompt_onekey.send( - self, - prompt = "Display mode", - keys = p, - callback = self.change_this_display_mode + opts = [i.name.lower() for i in contentviews.views] + self.master.overlay( + overlay.Chooser( + "display mode", + opts, + self.viewmode_get(), + self.change_this_display_mode + ) ) elif key == "E": if self.tab_offset == TAB_REQ: