From: Christian Heller Date: Fri, 18 Dec 2020 23:59:46 +0000 (+0100) Subject: In ASCII art drawing mode, pad short lines with whitespace to tolerate them. X-Git-Url: https://plomlompom.com/repos/%7B%7B%20web_path%20%7D%7D/decks/static/%7B%7Bitem_name%7D%7D?a=commitdiff_plain;h=2dc444966037a42b51ed190ab0eab88a09c0282a;p=plomrogue2 In ASCII art drawing mode, pad short lines with whitespace to tolerate them. --- diff --git a/rogue_chat.html b/rogue_chat.html index 45f04a6..82bfbed 100644 --- a/rogue_chat.html +++ b/rogue_chat.html @@ -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; diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 72fc0a7..f7ac8cf 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -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