2 if not hasattr(e
.window
, 'history'):
3 e
.window
.history
= [], -1
5 if e
.key
in ('Up', 'Down'):
6 h
, i
= e
.window
.history
8 if i
== -1 and e
.window
.input.text
:
9 h
.insert(0, e
.window
.input.text
)
16 e
.window
.history
= h
, i
18 e
.window
.input.text
= h
[i
]
19 e
.window
.input.cursor
= -1
25 e
.window
.history
= h
, i
27 e
.window
.input.text
= h
[i
]
28 e
.window
.input.cursor
= -1
31 e
.window
.history
= h
, i
33 e
.window
.input.text
= ''
34 e
.window
.input.cursor
= -1
37 if not hasattr(e
.window
, 'history'):
38 e
.window
.history
= [], -1
41 h
, i
= e
.window
.history
45 e
.window
.history
= h
, -1