hedgewars/uChat.pas
changeset 1819 17dac76954d1
parent 1485 51c11e77408a
child 1821 6b6cf3389f92
equal deleted inserted replaced
1818:4391c7037281 1819:17dac76954d1
   150 procedure KeyPressChat(Key: Longword);
   150 procedure KeyPressChat(Key: Longword);
   151 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
   151 const firstByteMark: array[1..4] of byte = (0, $C0, $E0, $F0);
   152 var i, btw: integer;
   152 var i, btw: integer;
   153     utf8: shortstring;
   153     utf8: shortstring;
   154 begin
   154 begin
       
   155 
   155 if Key <> 0 then
   156 if Key <> 0 then
   156 	case Key of
   157 	case Key of
   157 		8: if Length(InputStr.s) > 0 then
   158 		{Backspace}
       
   159 		8, 127: if Length(InputStr.s) > 0 then
   158 				begin
   160 				begin
   159 				InputStr.s[0]:= InputStrL[byte(InputStr.s[0])];
   161 				InputStr.s[0]:= InputStrL[byte(InputStr.s[0])];
   160 				SetLine(InputStr, InputStr.s, true)
   162 				SetLine(InputStr, InputStr.s, true)
   161 				end;
   163 				end;
       
   164 		{Esc}
   162 		27: SetLine(InputStr, '', true);
   165 		27: SetLine(InputStr, '', true);
       
   166 		{Return}
   163 		13, 271: begin
   167 		13, 271: begin
   164 			if Length(InputStr.s) > 0 then
   168 			if Length(InputStr.s) > 0 then
   165 				begin
   169 				begin
   166 				AcceptChatString(InputStr.s);
   170 				AcceptChatString(InputStr.s);
   167 				SetLine(InputStr, '', false)
   171 				SetLine(InputStr, '', false)
   168 				end;
   172 				end;
   169 			FreezeEnterKey;
   173 			FreezeEnterKey;
   170 			GameState:= gsGame
   174 			GameState:= gsGame
   171 			end
   175 			end;
       
   176 		{missing Mac keys}
       
   177 		{*
       
   178 			63272 is canc
       
   179 			63232 is UP
       
   180 			63234 is LEFT
       
   181 			63235 is RIGHT
       
   182 			63233 is DOWN
       
   183 		*}
       
   184 		63272, 63232, 36233, 36234, 36235: Key:=28;
   172 	else
   185 	else
   173 	if (Key < $80) then btw:= 1
   186 	if (Key < $80) then btw:= 1
   174 	else if (Key < $800) then btw:= 2
   187 	else if (Key < $800) then btw:= 2
   175 	else if (Key < $10000) then btw:= 3
   188 	else if (Key < $10000) then btw:= 3
   176 	else btw:= 4;
   189 	else btw:= 4;