you can use esc to exit chat when input is empty
authorkoda
Mon, 04 Apr 2011 16:27:27 +0200
changeset 5100 951767beffc8
parent 5099 ce1a761d3c1e
child 5101 a2b72f966073
you can use esc to exit chat when input is empty
hedgewars/uChat.pas
hedgewars/uKeys.pas
--- a/hedgewars/uChat.pas	Mon Apr 04 12:53:11 2011 +0200
+++ b/hedgewars/uChat.pas	Mon Apr 04 16:27:27 2011 +0200
@@ -269,7 +269,13 @@
                 SetLine(InputStr, InputStr.s, true)
                 end;
         {Esc}
-        27: SetLine(InputStr, '', true);
+        27: if Length(InputStr.s) > 0 then SetLine(InputStr, '', true)
+            else
+                begin
+                FreezeEnterKey;
+                SDL_EnableKeyRepeat(0,0);
+                GameState:= gsGame;
+                end;
         {Return}
         3, 13, 271: begin
             if Length(InputStr.s) > 0 then
@@ -342,9 +348,10 @@
     GameState:= gsChat;
     SDL_EnableKeyRepeat(200,45);
     if length(s) = 0 then
-        KeyPressChat(27)
+        SetLine(InputStr, '', true)
     else
         begin
+        // err, does anyone have any documentation on this sequence?
         KeyPressChat(27);
         KeyPressChat(47);
         KeyPressChat(116);
--- a/hedgewars/uKeys.pas	Mon Apr 04 12:53:11 2011 +0200
+++ b/hedgewars/uKeys.pas	Mon Apr 04 16:27:27 2011 +0200
@@ -386,7 +386,9 @@
 
 procedure FreezeEnterKey;
 begin
+    tkbd[3]:= 1;
     tkbd[13]:= 1;
+    tkbd[27]:= 1;
     tkbd[271]:= 1;
 end;