primitivus: moved history method definition out of keypress
This commit is contained in:
parent
c019542729
commit
747cc31583
1 changed files with 6 additions and 6 deletions
|
|
@ -148,13 +148,13 @@ class EditBar(sat_widgets.ModalEdit):
|
|||
return
|
||||
self.set_edit_text('')
|
||||
|
||||
def _historyCb(self, text):
|
||||
self.set_edit_text(text)
|
||||
self.set_edit_pos(len(text))
|
||||
|
||||
def keypress(self, size, key):
|
||||
"""Callback when a key is pressed. Send "composing" states
|
||||
and move the index of the temporary history stack."""
|
||||
def history_cb(text):
|
||||
self.set_edit_text(text)
|
||||
self.set_edit_pos(len(text))
|
||||
|
||||
if key == a_key['MODAL_ESCAPE']:
|
||||
# first save the text to the current mode, then change to NORMAL
|
||||
self.app._updateInputHistory(self.get_edit_text(), mode=self.mode)
|
||||
|
|
@ -162,10 +162,10 @@ class EditBar(sat_widgets.ModalEdit):
|
|||
if self._mode == 'NORMAL' and key in self._modes:
|
||||
self.app._updateInputHistory(mode=self._modes[key][0])
|
||||
if key == a_key['HISTORY_PREV']:
|
||||
self.app._updateInputHistory(self.get_edit_text(), -1, history_cb, self.mode)
|
||||
self.app._updateInputHistory(self.get_edit_text(), -1, self._history_cb, self.mode)
|
||||
return
|
||||
elif key == a_key['HISTORY_NEXT']:
|
||||
self.app._updateInputHistory(self.get_edit_text(), +1, history_cb, self.mode)
|
||||
self.app._updateInputHistory(self.get_edit_text(), +1, self._history_cb, self.mode)
|
||||
return
|
||||
elif key == a_key['EDIT_ENTER']:
|
||||
self.app._updateInputHistory(self.get_edit_text(), mode=self.mode)
|
||||
|
|
|
|||
Loading…
Reference in a new issue