home · contact · privacy
In ASCII art drawing mode, pad short lines with whitespace to tolerate them.
authorChristian Heller <c.heller@plomlompom.de>
Fri, 18 Dec 2020 23:59:46 +0000 (00:59 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Fri, 18 Dec 2020 23:59:46 +0000 (00:59 +0100)
rogue_chat.html
rogue_chat_curses.py

index 45f04a6ccf70e8e384f2e47d72fa358ce8382c2f..82bfbed97fd8902e48aca9e86bb8ec3e15c109eb 100644 (file)
@@ -1069,9 +1069,13 @@ let tui = {
       this.switch_mode('play');
   },
   enter_ascii_art: function(command) {
-      if (this.inputEl.value.length != 6) {
-          this.log_msg('? wrong input length, must be 6; try again');
+      if (this.inputEl.value.length > 6) {
+          this.log_msg('? wrong input length, must be max 6; try again');
           return;
+      } else if (this.inputEl.value.length < 6) {
+          while (this.inputEl.value.length < 6) {
+              this.inputEl.value += ' ';
+          }
       }
       this.log_msg('  ' + this.inputEl.value);
       this.full_ascii_draw += this.inputEl.value;
index 72fc0a7dddf94ed5ba1baff57c68f723e20d0b64..f7ac8cf0bf33c492eac88482d18f7c0b1a9c7c9b 100755 (executable)
@@ -1117,9 +1117,11 @@ class TUI:
             self.switch_mode('play')
 
         def enter_ascii_art(command):
-            if len(self.input_) != 6:
-                self.log_msg('? wrong input length, must be 6; try again')
+            if len(self.input_) > 6:
+                self.log_msg('? wrong input length, must be max 6; try again')
                 return
+            if len(self.input_) < 6:
+                self.input_ += ' ' * (6 - len(self.input_))
             self.log_msg('  ' + self.input_)
             self.full_ascii_draw += self.input_
             self.ascii_draw_stage += 1