Properly close chat after quit command
authorWuzzy <Wuzzy@disroot.org>
Wed, 24 May 2023 21:23:33 +0200
changeset 15983 416bca0a172c
parent 15982 28b692ef6f15
child 15984 6a985a680c44
Properly close chat after quit command
hedgewars/uChat.pas
hedgewars/uCommandHandlers.pas
--- a/hedgewars/uChat.pas	Fri May 12 23:15:01 2023 +0200
+++ b/hedgewars/uChat.pas	Wed May 24 21:23:33 2023 +0200
@@ -27,6 +27,7 @@
 procedure freeModule;
 procedure ReloadLines;
 procedure CleanupInput;
+procedure CloseChat;
 procedure AddChatString(s: shortstring);
 procedure DrawChat;
 procedure KeyPressChat(keysym: TSDL_Keysym);
@@ -782,6 +783,13 @@
     ResetKbd;
 end;
 
+procedure CloseChat;
+begin
+    SetLine(InputStr, '', true);
+    ResetCursor();
+    CleanupInput();
+end;
+
 procedure DelBytesFromInputStrBack(endIdx: integer; count: byte);
 var startIdx: integer;
 begin
--- a/hedgewars/uCommandHandlers.pas	Fri May 12 23:15:01 2023 +0200
+++ b/hedgewars/uCommandHandlers.pas	Wed May 24 21:23:33 2023 +0200
@@ -27,7 +27,7 @@
 
 implementation
 uses uCommands, uTypes, uVariables, uIO, uDebug, uConsts, uScript, uUtils, SDLh, uWorld, uRandom, uCaptions
-    , uVisualGearsList, uGearsHedgehog
+    , uVisualGearsList, uGearsHedgehog, uChat
      {$IFDEF USE_VIDEO_RECORDING}, uVideoRec {$ENDIF};
 
 var cTagsMasks : array[0..15] of byte = (7, 0, 0, 0, 0, 4, 5, 6, 15, 8, 8, 8, 8, 12, 13, 14);
@@ -50,7 +50,7 @@
     s:= s; // avoid compiler hint
     if (GameState = gsGame) then
     begin
-        isInChatMode:= false;
+        CloseChat;
         GameState:= gsConfirm;
     end
     else begin