From 2dc444966037a42b51ed190ab0eab88a09c0282a Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Sat, 19 Dec 2020 00:59:46 +0100 Subject: [PATCH] In ASCII art drawing mode, pad short lines with whitespace to tolerate them. --- rogue_chat.html | 8 ++++++-- rogue_chat_curses.py | 6 ++++-- 2 files changed, 10 insertions(+), 4 deletions(-) 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 -- 2.30.2