console: mark view indiciator, fix empty flow list behaviour

Fixes #1782
This commit is contained in:
Aldo Cortesi 2016-12-16 11:47:59 +13:00
parent 6b5673e849
commit e387c68b38
3 changed files with 12 additions and 3 deletions

View File

@ -178,8 +178,6 @@ class FlowItem(urwid.WidgetWrap):
elif key == "m": elif key == "m":
self.flow.marked = not self.flow.marked self.flow.marked = not self.flow.marked
signals.flowlist_change.send(self) signals.flowlist_change.send(self)
elif key == "M":
self.master.view.toggle_marked()
elif key == "r": elif key == "r":
try: try:
self.master.replay_request(self.flow) self.master.replay_request(self.flow)
@ -375,6 +373,8 @@ class FlowListBox(urwid.ListBox):
prompt = "Load flows", prompt = "Load flows",
callback = self.master.load_flows_callback callback = self.master.load_flows_callback
) )
elif key == "M":
self.master.view.toggle_marked()
elif key == "n": elif key == "n":
signals.status_prompt_onekey.send( signals.status_prompt_onekey.send(
prompt = "Method", prompt = "Method",

View File

@ -263,8 +263,12 @@ class StatusBar(urwid.WidgetWrap):
else: else:
arrow = common.SYMBOL_DOWN arrow = common.SYMBOL_DOWN
marked = ""
if self.master.view.show_marked:
marked = "M"
t = [ t = [
('heading', ("%s [%s/%s]" % (arrow, offset, fc)).ljust(11)), ('heading', ("%s %s [%s/%s]" % (arrow, marked, offset, fc)).ljust(11)),
] ]
if self.master.server.bound: if self.master.server.bound:

View File

@ -123,6 +123,11 @@ def test_filter():
v.set_filter(None) v.set_filter(None)
assert len(v) == 4 assert len(v) == 4
v.toggle_marked()
assert len(v) == 0
v.toggle_marked()
assert len(v) == 4
v[1].marked = True v[1].marked = True
v.toggle_marked() v.toggle_marked()
assert len(v) == 1 assert len(v) == 1