290 end |
290 end |
291 else |
291 else |
292 ParseCommand('/say ' + s, true); |
292 ParseCommand('/say ' + s, true); |
293 end; |
293 end; |
294 |
294 |
|
295 procedure CleanupInput; |
|
296 begin |
|
297 FreezeEnterKey; |
|
298 history:= 0; |
|
299 SDL_EnableKeyRepeat(0,0); |
|
300 GameState:= gsGame; |
|
301 ResetKbd; |
|
302 end; |
|
303 |
295 procedure KeyPressChat(Key: Longword); |
304 procedure KeyPressChat(Key: Longword); |
296 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
305 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
297 var i, btw, index: integer; |
306 var i, btw, index: integer; |
298 utf8, chatLine: shortstring; |
307 utf8, chatLine: shortstring; |
299 begin |
308 begin |
300 if Key <> 0 then |
309 if Key <> 0 then |
301 case Key of |
310 case Key of |
302 {Backspace} |
311 {Backspace} |
303 8, 127: if Length(InputStr.s) > 0 then |
312 8, 127: if Length(InputStr.s) > 0 then |
304 begin |
313 begin |
305 history:= 0; |
|
306 InputStr.s[0]:= InputStrL[byte(InputStr.s[0])]; |
314 InputStr.s[0]:= InputStrL[byte(InputStr.s[0])]; |
307 SetLine(InputStr, InputStr.s, true) |
315 SetLine(InputStr, InputStr.s, true) |
308 end; |
316 end; |
309 {Esc} |
317 {Esc} |
310 27: if Length(InputStr.s) > 0 then SetLine(InputStr, '', true) |
318 27: if Length(InputStr.s) > 0 then SetLine(InputStr, '', true) |
311 else |
319 else CleanupInput; |
312 begin |
|
313 FreezeEnterKey; |
|
314 history:= 0; |
|
315 SDL_EnableKeyRepeat(0,0); |
|
316 GameState:= gsGame; |
|
317 ResetKbd; |
|
318 end; |
|
319 {Return} |
320 {Return} |
320 3, 13, 271: begin |
321 3, 13, 271: begin |
321 if Length(InputStr.s) > 0 then |
322 if Length(InputStr.s) > 0 then |
322 begin |
323 begin |
323 AcceptChatString(InputStr.s); |
324 AcceptChatString(InputStr.s); |
324 SetLine(InputStr, '', false) |
325 SetLine(InputStr, '', false) |
325 end; |
326 end; |
326 FreezeEnterKey; |
327 CleanupInput; |
327 history:= 0; |
|
328 SDL_EnableKeyRepeat(0,0); |
|
329 GameState:= gsGame; |
|
330 ResetKbd; |
|
331 end; |
328 end; |
332 {arrow keys (up, down)} |
329 {arrow keys (up, down)} |
333 63232, 63233: begin |
330 63232, 63233: begin |
334 |
331 |
335 if (Key = 63232) and (history < lastStr) then inc(history); |
332 if (Key = 63232) and (history < lastStr) then inc(history); |