}
this.mode = mode;
this.empty_input();
- if (mode == mode_annotate && explorer.position in explorer.info_db) {
- let info = explorer.info_db[explorer.position];
- if (info != "(none)") {
- this.inputEl.value = info;
- this.recalc_input_lines();
- }
- } else if (mode == mode_login) {
+ this.restore_input_values();
+ if (mode == mode_login) {
if (this.login_name) {
server.send(['LOGIN', this.login_name]);
} else {
}
} else if (mode == mode_edit) {
this.show_help = true;
- } else if (mode == mode_portal && explorer.position in game.portals) {
- let portal = game.portals[explorer.position]
- this.inputEl.value = portal;
- this.recalc_input_lines();
- } else if (mode == mode_password) {
- this.inputEl.value = this.password;
- this.recalc_input_lines();
} else if (mode == mode_teleport) {
tui.log_msg("@ May teleport to: " + tui.teleport_target);
tui.log_msg("@ Enter 'YES!' to entusiastically affirm.");
}
this.full_refresh();
},
+ restore_input_values: function() {
+ if (this.mode == mode_annotate && explorer.position in explorer.info_db) {
+ let info = explorer.info_db[explorer.position];
+ if (info != "(none)") {
+ this.inputEl.value = info;
+ this.recalc_input_lines();
+ }
+ } else if (this.mode == mode_portal && explorer.position in game.portals) {
+ let portal = game.portals[explorer.position]
+ this.inputEl.value = portal;
+ this.recalc_input_lines();
+ } else if (this.mode == mode_password) {
+ this.inputEl.value = this.password;
+ this.recalc_input_lines();
+ }
+ },
empty_input: function(str) {
this.inputEl.value = "";
if (this.mode.has_input_prompt) {
if (tui.mode.has_input_prompt && event.key == 'Enter' && tui.inputEl.value == '/help') {
tui.show_help = true;
tui.empty_input();
+ tui.restore_input_values();
tui.full_refresh();
} else if (!tui.mode.has_input_prompt && event.key == tui.keys.help) {
tui.show_help = true;