home · contact · privacy
Fix bug that emptied annotation input on pre-existing annotation.
authorChristian Heller <c.heller@plomlompom.de>
Wed, 18 Nov 2020 03:42:04 +0000 (04:42 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 18 Nov 2020 03:42:04 +0000 (04:42 +0100)
rogue_chat_curses.py
rogue_chat_nocanvas_monochrome.html

index 8c629a596d2fe71fff4527b37263eded28a88495..15f4cd2db0b8773ff1ab68dd05abdc971f9227db 100755 (executable)
@@ -155,6 +155,7 @@ cmd_ARGUMENT_ERROR.argtypes = 'string'
 
 def cmd_ANNOTATION(game, position, msg):
     game.info_db[position] = msg
 
 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'
     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)
         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':
         if self.mode.name == 'waiting_for_server':
             self.log_msg('@ waiting for server …')
         if self.mode.name == 'edit':
index c50a12f20c0f717d39a5d4911029de170f0d7f6b..a5b2d69d81913938ba42c2ec4b9bee549e7779df 100644 (file)
@@ -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]);
         } 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') {
         } 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;
     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();
     }
     this.mode = mode;
     this.empty_input();