diff kitten: Clear the search when pressing Esc

This commit is contained in:
Kovid Goyal 2018-06-15 15:00:09 +05:30
parent 1022d8a0ee
commit 84b99b1b3d
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
2 changed files with 6 additions and 1 deletions

View File

@ -67,7 +67,7 @@ Keyboard controls
========================= ===========================
Action Shortcut
========================= ===========================
Quit :kbd:`q, Ctrl+c`
Quit :kbd:`q, Ctrl+c, Esc`
Scroll line up :kbd:`k, up`
Scroll line down :kbd:`j, down`
Scroll page up :kbd:`PgUp`
@ -84,6 +84,7 @@ All lines of context :kbd:`a`
Restore default context :kbd:`=`
Search forwards :kbd:`/`
Search backwards :kbd:`?`
Clear search :kbd:`Esc`
Scroll to next match :kbd:`>, .`
Scroll to previous match :kbd:`<, ,`
========================= ===========================

View File

@ -390,6 +390,10 @@ class DiffHandler(Handler):
self.line_edit.clear()
self.draw_screen()
return
if self.state >= DIFFED and self.current_search is not None and key_event.key is ESCAPE:
self.current_search = None
self.draw_screen()
return
action = self.shortcut_action(key_event)
if action is not None:
return self.perform_action(action)