[tui] help shortcut command raise list index out of range (closes #98677)

Input ":?[enter]" into footer prompt, raise IndexError: list index out of range.

authorTakumi IINO <trot.thunder@gmail.com>
changeset6ed904105bcc
branchstable
phasepublic
hiddenno
parent revision#67eb0203eace [tui] ctx.description(): always tries to convert to unicode (closes #98647)
child revision#96922b47a8a8 [tui] call ``set`` directly instead of ``footer`` attribute that does not exist (closes #98669)
files modified by this revision
hgviewlib/curses/mainframe.py
# HG changeset patch
# User Takumi IINO <trot.thunder@gmail.com>
# Date 1340005410 -7200
# Mon Jun 18 09:43:30 2012 +0200
# Branch stable
# Node ID 6ed904105bcc48b54ab1c37373387b7b048f31b6
# Parent 67eb0203eacebbb727c8c1e2f7e5bcc13b6c08fe
[tui] help shortcut command raise list index out of range (closes #98677)

Input ":?[enter]" into footer prompt, raise IndexError: list index out of range.

diff --git a/hgviewlib/curses/mainframe.py b/hgviewlib/curses/mainframe.py
@@ -267,11 +267,13 @@
1          cmdline = self.get_edit_text()
2          if not cmdline:
3              self.footer.set('default', '', '')
4              return
5          cmdline = cmdline.strip()
6 -        if cmdline.endswith('?'):
7 +        if cmdline == '?':
8 +            cmdline = 'help'
9 +        elif cmdline.endswith('?'):
10              cmdline = 'help %s' % cmdline[:-1].split(None, 1)[0]
11          elif cmdline.startswith('?'):
12              cmdline = 'help %s' % cmdline[1:].split(None, 1)[0]
13          try:
14              emit_command(cmdline)