firecat53 / urlscan

Mutt and terminal url selector (similar to urlview)
GNU General Public License v2.0
213 stars 37 forks source link

Mouse selection leads to error #65

Closed oimaasi closed 6 years ago

oimaasi commented 6 years ago

I can safely reproduce the following error when trying to select some text in the urlscan browser using a mouse.

Traceback (most recent call last):
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 376, in _run
    self.start()
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 344, in start
    "Screen {0!r} doesn't support external event loops")
urwid.main_loop.CantUseExternalLoop: Screen {0!r} doesn't support external event loops

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/urlscan", line 176, in <module>
    ui.main()
  File "/usr/lib/python3.6/site-packages/urlscan/urlchoose.py", line 97, in main
    loop.run()
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 286, in run
    self._run()
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 379, in _run
    return self._run_screen_event_loop()
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 447, in _run_screen_event_loop
    self.process_input(keys)
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 517, in process_input
    something_handled |= bool(self.unhandled_input(k))
  File "/usr/lib/python3.6/site-packages/urwid/main_loop.py", line 563, in unhandled_input
    return self._unhandled_input(input)
  File "/usr/lib/python3.6/site-packages/urlscan/urlchoose.py", line 122, in unhandled
    elif k.isdigit():
AttributeError: 'int' object has no attribute 'isdigit'

I am actually not intending to use mouse in urlscan. Today I just happened to be playing with it a little bit to debug my script. So it is not a big deal. But it could be added to known bugs and limitations. On a second thought, there are indeed some situations where mouse selection might make sense. For example, when I urlscan in a headless remote server and want to copy a link to my local computer running X.

OK, in theory I can assign an exclusive shortcut in muttrc just for urlscan --run 'echo {} | xclip ...

firecat53 commented 6 years ago

Fixed. Thanks! You should still be able to select text using the mouse. Works for me with both urxvt and xterm.