home · contact · privacy
Don't provide space for unused input line.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 28 Oct 2020 23:24:20 +0000 (00:24 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 28 Oct 2020 23:24:20 +0000 (00:24 +0100)
new2/rogue_chat_nocanvas_monochrome.html

index 32a3781161f622a21d09c574843f75378454b2e2..43c7ce85d5f87823976a5a2ecdbffbcbfa3a3d64 100644 (file)
@@ -161,6 +161,7 @@ let tui = {
       explorer.position = game.things[game.player_id];
     }
     this.mode = mode_name;
       explorer.position = game.things[game.player_id];
     }
     this.mode = mode_name;
+    this.empty_input();
     this.full_refresh();
   },
   draw_history: function() {
     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);
         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;
       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 = "";
   },
   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) {
   },
   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);
   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();
         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.full_refresh();
         } else if (event.key == 'Enter') {
             explorer.annotate(tui.input);
-            tui.empty_input();
             tui.switch_mode('study', true);
         }
     }
             tui.switch_mode('study', true);
         }
     }