if (event.key == 'Enter') {
event.preventDefault();
}
- if (tui.mode.has_input_prompt && event.key == 'Enter'
- && tui.inputEl.value.length == 0
- && ['chat', 'command_thing', 'take_thing', 'drop_thing',
- 'admin_enter'].includes(tui.mode.name)) {
- if (tui.mode.name != 'chat') {
+ if ((!tui.mode.is_intro && event.key == 'Escape')
+ || (tui.mode.has_input_prompt && event.key == 'Enter'
+ && tui.inputEl.value.length == 0
+ && ['chat', 'command_thing', 'take_thing', 'drop_thing',
+ 'admin_enter'].includes(tui.mode.name))) {
+ if (!['chat', 'play', 'study', 'edit'].includes(tui.mode.name)) {
tui.log_msg('@ aborted');
}
tui.switch_mode('play');
self.do_refresh = True
except curses.error:
continue
- self.show_help = False
+ keycode = None
+ if len(key) == 1:
+ keycode = ord(key)
if key == 'KEY_RESIZE':
reset_screen_size()
elif self.mode.has_input_prompt and key == 'KEY_BACKSPACE':
self.input_ = self.input_[:-1]
- elif self.mode.has_input_prompt and key == '\n' and self.input_ == ''\
- and self.mode.name in {'chat', 'command_thing', 'take_thing',
- 'drop_thing', 'admin_enter'}:
- if self.mode.name != 'chat':
+ elif (((not self.mode.is_intro) and keycode == 27) # Escape
+ or (self.mode.has_input_prompt and key == '\n'
+ and self.input_ == ''\
+ and self.mode.name in {'chat', 'command_thing',
+ 'take_thing', 'drop_thing',
+ 'admin_enter'})):
+ if self.mode.name not in {'chat', 'play', 'study', 'edit'}:
self.log_msg('@ aborted')
self.switch_mode('play')
elif self.mode.has_input_prompt and key == '\n' and self.input_ == '/help':