From: Christian Heller Date: Wed, 28 Oct 2020 23:38:47 +0000 (+0100) Subject: Add mode line. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7Bdb.prefix%7D%7D/%7B%7B%20web_path%20%7D%7D/%27%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28escapeHTML%28span%5B2%5D%29%29;%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20chunks.push%28%27?a=commitdiff_plain;h=7d730b5350cc53c3d43b12f14042b1b03a123297;p=plomrogue2-experiments Add mode line. --- diff --git a/new2/rogue_chat_nocanvas_monochrome.html b/new2/rogue_chat_nocanvas_monochrome.html index 43c7ce8..02d6d6b 100644 --- a/new2/rogue_chat_nocanvas_monochrome.html +++ b/new2/rogue_chat_nocanvas_monochrome.html @@ -152,9 +152,11 @@ let tui = { input_lines: [], window_width: terminal.cols / 2, height_turn_line: 1, + height_mode_line: 1, height_input: 1, init: function() { this.recalc_input_lines(); + this.height_header = this.height_turn_line + this.height_mode_line; }, switch_mode: function(mode_name, keep_pos=false) { if (mode_name == 'study' && !keep_pos) { @@ -164,14 +166,18 @@ let tui = { this.empty_input(); this.full_refresh(); }, + draw_mode_line: function() { + terminal.drawBox(1, this.window_width, this.height_mode_line, this.window_width); + terminal.write(1, this.window_width, 'MODE ' + this.mode); + }, draw_history: function() { - if (terminal.rows <= this.height_turn_line + this.height_input) { + if (terminal.rows <= this.height_header + this.height_input) { return; } - terminal.drawBox(this.height_turn_line, this.window_width, terminal.rows - this.height_turn_line - this.height_input, this.window_width); - for (let y = terminal.rows - this.height_input - this.height_turn_line, + terminal.drawBox(this.height_header, this.window_width, terminal.rows - this.height_header - this.height_input, this.window_width); + for (let y = terminal.rows - 1 - this.height_input, i = this.log.length - 1; - y >= this.height_turn_line && i >= 0; + y >= this.height_header && i >= 0; y--, i--) { terminal.write(y, this.window_width, this.log[i]); } @@ -300,15 +306,16 @@ let tui = { tui.log_msg(""); }, draw_info: function() { - terminal.drawBox(this.height_turn_line, this.window_width, terminal.rows - this.height_turn_line - this.height_input, this.window_width); + terminal.drawBox(this.height_header, this.window_width, terminal.rows - this.height_header - this.height_input, this.window_width); let lines = this.msg_into_lines_of_width(explorer.get_info(), this.window_width); - for (let y = this.height_turn_line, i = 0; y < terminal.rows && i < lines.length; y++, i++) { + for (let y = this.height_header, i = 0; y < terminal.rows && i < lines.length; y++, i++) { terminal.write(y, this.window_width, lines[i]); } }, full_refresh: function() { this.draw_map(); this.draw_turn_line(); + this.draw_mode_line(); if (this.mode == 'study' || this.mode == 'annotate') { this.draw_info(); } else {