Separate search and refine search commands

Being able to refine a search query is useful, but so is being able
to quickly open a specific change from anywhere.  Separate these
commands.  C-o opens a blank search input; M-o opens a search input
pre-filled with th ecurrent query in list view.

Change-Id: I49d0f076354322a2652de515d476548926a99182
This commit is contained in:
James E. Blair 2015-10-20 14:55:25 -07:00 committed by James E. Blair
parent da0178b2da
commit b0f595b1c1
3 changed files with 9 additions and 5 deletions

View File

@ -515,11 +515,7 @@ class App(object):
elif keymap.QUIT in commands:
self.quit()
elif keymap.CHANGE_SEARCH in commands:
if hasattr(self.loop.widget, 'getQueryString'):
default = self.loop.widget.getQueryString()
else:
default = ''
self.searchDialog(default)
self.searchDialog('')
elif keymap.LIST_HELD in commands:
self.doSearch("is:held")
elif key in self.config.dashboards:

View File

@ -35,6 +35,7 @@ TOP_SCREEN = 'top screen'
HELP = 'help'
QUIT = 'quit'
CHANGE_SEARCH = 'change search'
REFINE_CHANGE_SEARCH = 'refine change search'
LIST_HELD = 'list held changes'
# Change screen:
TOGGLE_REVIEWED = 'toggle reviewed'
@ -87,6 +88,7 @@ DEFAULT_KEYMAP = {
HELP: ['f1', '?'],
QUIT: 'ctrl q',
CHANGE_SEARCH: 'ctrl o',
REFINE_CHANGE_SEARCH: 'meta o',
LIST_HELD: 'f12',
TOGGLE_REVIEWED: 'v',

View File

@ -178,6 +178,8 @@ class ChangeListView(urwid.WidgetWrap):
"Toggle the starred flag for the currently selected change"),
(key(keymap.TOGGLE_MARK),
"Toggle the process mark for the currently selected change"),
(key(keymap.REFINE_CHANGE_SEARCH),
"Refine the current search query"),
(key(keymap.EDIT_TOPIC),
"Set the topic of the marked changes"),
(key(keymap.REFRESH),
@ -559,6 +561,10 @@ class ChangeListView(urwid.WidgetWrap):
row = self.listbox.body[pos]
self.app.localCherryPickCommit(row.project_name, row.commit_sha)
return None
if keymap.REFINE_CHANGE_SEARCH in commands:
default = self.getQueryString()
self.app.searchDialog(default)
return None
return key
def onSelect(self, button, change_key):