From 43591a0ee2c85a98730aac730aded8c0a8cdba57 Mon Sep 17 00:00:00 2001 From: Christian Heller Date: Wed, 18 Nov 2020 04:42:04 +0100 Subject: [PATCH] Fix bug that emptied annotation input on pre-existing annotation. --- rogue_chat_curses.py | 2 ++ rogue_chat_nocanvas_monochrome.html | 3 +++ 2 files changed, 5 insertions(+) diff --git a/rogue_chat_curses.py b/rogue_chat_curses.py index 8c629a5..15f4cd2 100755 --- a/rogue_chat_curses.py +++ b/rogue_chat_curses.py @@ -155,6 +155,7 @@ cmd_ARGUMENT_ERROR.argtypes = 'string' def cmd_ANNOTATION(game, position, msg): game.info_db[position] = msg + game.tui.restore_input_values() if game.tui.mode.shows_info: game.tui.do_refresh = True cmd_ANNOTATION.argtypes = 'yx_tuple:nonneg string' @@ -366,6 +367,7 @@ class TUI: if self.mode.shows_info: player = self.game.get_thing(self.game.player_id) self.explorer = YX(player.position.y, player.position.x) + self.query_info() if self.mode.name == 'waiting_for_server': self.log_msg('@ waiting for server …') if self.mode.name == 'edit': diff --git a/rogue_chat_nocanvas_monochrome.html b/rogue_chat_nocanvas_monochrome.html index c50a12f..a5b2d69 100644 --- a/rogue_chat_nocanvas_monochrome.html +++ b/rogue_chat_nocanvas_monochrome.html @@ -277,6 +277,8 @@ let server = { } else if (tokens[0] === 'ANNOTATION') { let position = parser.parse_yx(tokens[1]); explorer.update_info_db(position, tokens[2]); + tui.restore_input_values(); + tui.full_refresh(); } else if (tokens[0] === 'UNHANDLED_INPUT') { tui.log_msg('? unknown command'); } else if (tokens[0] === 'PLAY_ERROR') { @@ -386,6 +388,7 @@ let tui = { this.map_mode = 'terrain'; if (mode.shows_info && game.player_id in game.things) { explorer.position = game.things[game.player_id].position; + explorer.query_info(); } this.mode = mode; this.empty_input(); -- 2.30.2