From: Christian Heller Date: Wed, 28 Oct 2020 23:24:20 +0000 (+0100) Subject: Don't provide space for unused input line. X-Git-Url: https://plomlompom.com/repos/index.html?a=commitdiff_plain;h=c528fe926c6cbca9802e88d143e2d5a1a9f98822;p=plomrogue2-experiments Don't provide space for unused input line. --- diff --git a/new2/rogue_chat_nocanvas_monochrome.html b/new2/rogue_chat_nocanvas_monochrome.html index 32a3781..43c7ce8 100644 --- a/new2/rogue_chat_nocanvas_monochrome.html +++ b/new2/rogue_chat_nocanvas_monochrome.html @@ -161,6 +161,7 @@ let tui = { explorer.position = game.things[game.player_id]; } this.mode = mode_name; + this.empty_input(); this.full_refresh(); }, draw_history: function() { @@ -168,7 +169,6 @@ let tui = { return; } terminal.drawBox(this.height_turn_line, this.window_width, terminal.rows - this.height_turn_line - this.height_input, this.window_width); - console.log(this.log); for (let y = terminal.rows - this.height_input - this.height_turn_line, i = this.log.length - 1; y >= this.height_turn_line && i >= 0; @@ -220,7 +220,11 @@ let tui = { }, empty_input: function(str) { this.input = ""; - this.recalc_input_lines(); + if (this.mode == 'annotate' || this.mode == 'chat') { + this.recalc_input_lines(); + } else { + this.height_input = 0; + } }, add_to_input: function(str) { if (this.input.length + str.length > this.window_width * terminal.rows) { @@ -262,7 +266,7 @@ let tui = { log_msg: function(msg) { let lines = this.msg_into_lines_of_width(msg, this.window_width); this.log = this.log.concat(lines); - while (this.log.length > terminal.rows - 2) { + while (this.log.length > terminal.rows) { this.log.shift(); }; this.draw_history(); @@ -529,7 +533,6 @@ document.addEventListener('keydown', (event) => { tui.full_refresh(); } else if (event.key == 'Enter') { explorer.annotate(tui.input); - tui.empty_input(); tui.switch_mode('study', true); } }