troter

[tui] help shortcut command raise list index out of range

Jun 11th, 2012
71
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # HG changeset patch
  2. # User Takumi IINO <trot.thunder@gmail.com>
  3. # Date 1339428758 -32400
  4. # Node ID c35ef1706ac2b3788cb01641d7061de075146d87
  5. # Parent  ebdaabf52b73e635d2c9348005e4529c2218d041
  6. [tui] help shortcut command raise list index out of range
  7.  
  8. Input ":?[enter]" into footer prompt, raise IndexError: list index out of range.
  9.  
  10. Traceback (most recent call last):
  11.   File "/usr/bin/hgview", line 33, in <module>
  12.     main()
  13.   File "/usr/lib/python2.6/site-packages/hgviewlib/application.py", line 192, in main
  14.     sys.exit(start(repo, opts, args, parser.error))
  15.   File "/usr/lib/python2.6/site-packages/hgviewlib/application.py", line 143, in start
  16.     return app.exec_()
  17.   File "/usr/lib/python2.6/site-packages/hgviewlib/curses/application.py", line 87, in exec_
  18.     out = self.mainloop.run()
  19.   File "/usr/lib/python2.6/site-packages/urwid/main_loop.py", line 274, in run
  20.     self.screen.run_wrapper(self._run)
  21.   File "/usr/lib/python2.6/site-packages/urwid/raw_display.py", line 237, in run_wrapper
  22.     return fn()
  23.   File "/usr/lib/python2.6/site-packages/urwid/main_loop.py", line 307, in _run
  24.     self.event_loop.run()
  25.   File "/usr/lib/python2.6/site-packages/urwid/main_loop.py", line 682, in run
  26.     self._loop()
  27.   File "/usr/lib/python2.6/site-packages/urwid/main_loop.py", line 720, in _loop
  28.     self._watch_files[fd]()
  29.   File "/usr/lib/python2.6/site-packages/urwid/main_loop.py", line 358, in _update
  30.     self.process_input(keys)
  31.   File "/usr/lib/python2.6/site-packages/urwid/main_loop.py", line 447, in process_input
  32.     k = self._topmost_widget.keypress(self.screen_size, k)
  33.   File "/usr/lib/python2.6/site-packages/hgviewlib/curses/mainframe.py", line 141, in keypress
  34.     key = super(MainFrame, self).keypress(size, key)
  35.   File "/usr/lib/python2.6/site-packages/urwid/container.py", line 629, in keypress
  36.     return self.footer.keypress((maxcol,),key)
  37.   File "/usr/lib/python2.6/site-packages/hgviewlib/curses/mainframe.py", line 204, in keypress
  38.     cmdline = self.call_command()
  39.   File "/usr/lib/python2.6/site-packages/hgviewlib/curses/mainframe.py", line 273, in call_command
  40.     cmdline = 'help %s' % cmdline[:-1].split(None, 1)[0]
  41. IndexError: list index out of range
  42.  
  43. diff --git a/hgviewlib/curses/mainframe.py b/hgviewlib/curses/mainframe.py
  44. --- a/hgviewlib/curses/mainframe.py
  45. +++ b/hgviewlib/curses/mainframe.py
  46. @@ -269,7 +269,9 @@
  47.              self.footer.set('default', '', '')
  48.              return
  49.          cmdline = cmdline.strip()
  50. -        if cmdline.endswith('?'):
  51. +        if cmdline == '?':
  52. +            cmdline = 'help'
  53. +        elif cmdline.endswith('?'):
  54.              cmdline = 'help %s' % cmdline[:-1].split(None, 1)[0]
  55.          elif cmdline.startswith('?'):
  56.              cmdline = 'help %s' % cmdline[1:].split(None, 1)[0]
RAW Paste Data