From 62330e4b0f690e1b5a187b0b1d18654fc51dfe8a Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Tue, 2 Jun 2015 11:05:45 +1200 Subject: [PATCH] Enable mouse interaction, add a hint for selecting text. Fixes #597 --- libmproxy/console/__init__.py | 1 + libmproxy/console/window.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 8f39e2835..7d4a11642 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -416,6 +416,7 @@ class ConsoleMaster(flow.FlowMaster): def run(self): self.ui = urwid.raw_display.Screen() + self.ui.set_mouse_tracking() self.ui.set_terminal_properties(256) self.set_palette(self.palette) self.loop = urwid.MainLoop( diff --git a/libmproxy/console/window.py b/libmproxy/console/window.py index d64e83df4..600ae4137 100644 --- a/libmproxy/console/window.py +++ b/libmproxy/console/window.py @@ -17,6 +17,16 @@ class Window(urwid.Frame): def sig_focus(self, sender, section): self.focus_position = section + def mouse_event(self, *args, **kwargs): + # args: (size, event, button, col, row) + k = super(self.__class__, self).mouse_event(*args, **kwargs) + if args[1] == "mouse drag": + signals.status_message.send( + message = "Hold down alt or ctrl to select text.", + expire = 1 + ) + return False + def keypress(self, size, k): k = super(self.__class__, self).keypress(size, k) if k == "?":