- terminal.drawBox(0, terminal.cols / 2, 1, terminal.cols / 2);
- terminal.write(0, terminal.cols / 2, 'turn: ' + game.turn);
+ terminal.drawBox(0, this.window_width, 1, this.window_width);
+ terminal.write(0, this.window_width, 'turn: ' + game.turn);
+ },
+ empty_input: function(str) {
+ this.input = "";
+ this.recalc_input_lines();
+ },
+ add_to_input: function(str) {
+ if (this.input.length + str.length > this.window_width * terminal.rows) {
+ return;
+ }
+ this.input += str;
+ this.recalc_input_lines();
+ },
+ recalc_input_lines: function() {
+ this.input_lines = this.msg_into_lines_of_width("> " + this.input, this.window_width);
+ this.height_input = this.input_lines.length;
+ },
+ shorten_input: function() {
+ if (this.input.length > 2) {
+ this.input = tui.input.slice(0, -1);
+ this.recalc_input_lines();
+ }