# HG changeset patch # User Goffi # Date 1409850357 -7200 # Node ID 2ff15a6c5791633a63e5226a4a5d4d097cb42a84 # Parent 85fd02356dba238003e48dd5f0ecbeee1c926fad primitivus: moved history method definition out of keypress diff -r 85fd02356dba -r 2ff15a6c5791 frontends/src/primitivus/primitivus --- a/frontends/src/primitivus/primitivus Thu Sep 04 19:05:57 2014 +0200 +++ b/frontends/src/primitivus/primitivus Thu Sep 04 19:05:57 2014 +0200 @@ -148,13 +148,13 @@ 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 @@ 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)