explorer.query_info();
}
}
- this.empty_input();
+ this.inputEl.value = "";
this.restore_input_values();
for (let el of document.getElementsByTagName("button")) {
el.disabled = true;
let info = explorer.info_db[explorer.position];
if (info != "(none)") {
this.inputEl.value = info;
- this.recalc_input_lines();
}
} else if (this.mode.name == 'portal' && explorer.position in game.portals) {
let portal = game.portals[explorer.position]
this.inputEl.value = portal;
- this.recalc_input_lines();
} else if (this.mode.name == 'password') {
this.inputEl.value = this.password;
- this.recalc_input_lines();
} else if (this.mode.name == 'name_thing') {
let t = game.get_thing(this.selected_thing_id);
if (t && t.name_) {
this.inputEl.value = t.name_;
- this.recalc_input_lines();
}
}
},
- empty_input: function(str) {
- this.inputEl.value = "";
+ recalc_input_lines: function() {
if (this.mode.has_input_prompt) {
- this.recalc_input_lines();
+ let _ = null;
+ [this.input_lines, _] = this.msg_into_lines_of_width(this.input_prompt + this.inputEl.value, this.window_width);
} else {
- this.height_input = 0;
+ this.input_lines = [];
}
- },
- recalc_input_lines: function() {
- let _ = null;
- [this.input_lines, _] = this.msg_into_lines_of_width(this.input_prompt + this.inputEl.value, this.window_width);
this.height_input = this.input_lines.length;
},
msg_into_lines_of_width: function(msg, width) {
full_refresh: function() {
this.links = {};
terminal.drawBox(0, 0, terminal.rows, terminal.cols);
+ this.recalc_input_lines();
if (this.mode.is_intro) {
this.draw_history();
this.draw_input();
if (tui.inputEl.value.length > max_length) {
tui.inputEl.value = tui.inputEl.value.slice(0, max_length);
};
- tui.recalc_input_lines();
} else if (tui.mode.name == 'write' && tui.inputEl.value.length > 0) {
server.send(["TASK:WRITE", tui.inputEl.value[0], tui.password]);
tui.switch_mode('edit');
}
if (tui.mode.has_input_prompt && event.key == 'Enter' && tui.inputEl.value == '/help') {
tui.show_help = true;
- tui.empty_input();
+ tui.inputEl.value = "";
tui.restore_input_values();
} else if (!tui.mode.has_input_prompt && event.key == tui.keys.help
&& !tui.mode.is_single_char_entry) {
} else if (tui.mode.name == 'login' && event.key == 'Enter') {
tui.login_name = tui.inputEl.value;
server.send(['LOGIN', tui.inputEl.value]);
- tui.empty_input();
+ tui.inputEl.value = "";
} else if (tui.mode.name == 'control_pw_pw' && event.key == 'Enter') {
if (tui.inputEl.value.length == 0) {
tui.log_msg('@ aborted');
} else if (tui.inputEl.valuelength > 0) {
server.send(['ALL', tui.inputEl.value]);
}
- tui.empty_input();
+ tui.inputEl.value = "";
} else if (tui.mode.name == 'play') {
if (tui.mode.mode_switch_on_key(event)) {
null;