From 6d71e41fbcca9a3f337751367fa0088dcb9575a7 Mon Sep 17 00:00:00 2001
From: Christian Heller <c.heller@plomlompom.de>
Date: Thu, 29 Oct 2020 01:57:22 +0100
Subject: [PATCH] Improved input prompt handling.

---
 new2/rogue_chat_nocanvas_monochrome.html | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/new2/rogue_chat_nocanvas_monochrome.html b/new2/rogue_chat_nocanvas_monochrome.html
index 096b6d5..7554e57 100644
--- a/new2/rogue_chat_nocanvas_monochrome.html
+++ b/new2/rogue_chat_nocanvas_monochrome.html
@@ -173,6 +173,7 @@ let mode_edit = new Mode('edit', false, false);
 let tui = {
   mode: mode_chat,
   log: [],
+  input_prompt: '> ',
   input: '',
   input_lines: [],
   window_width: terminal.cols / 2,
@@ -258,14 +259,14 @@ let tui = {
       }
   },
   add_to_input: function(str) {
-      if (this.input.length + str.length > this.window_width * terminal.rows) {
+      if (this.input_prompt.length + 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.input_lines = this.msg_into_lines_of_width(this.input_prompt + this.input, this.window_width);
       this.height_input = this.input_lines.length;
   },
   shorten_input: function() {
-- 
2.30.2