# HG changeset patch # User sheepluva # Date 1436735739 -7200 # Node ID bd62cdbea3918fb08e3bfce84d06311959bc28e8 # Parent 9e4baaeade99271a5e543f39e8c778b514f1c476 chat: make sure that CTRL is the /only/ modifier key pressed when detecting ctrl+a etc diff -r 9e4baaeade99 -r bd62cdbea391 hedgewars/uChat.pas --- a/hedgewars/uChat.pas Sun Jul 12 08:20:33 2015 +0200 +++ b/hedgewars/uChat.pas Sun Jul 12 23:15:39 2015 +0200 @@ -794,9 +794,10 @@ procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); + nonStateMask = (not (KMOD_NUM or KMOD_CAPS)); var i, btw, index: integer; utf8: shortstring; - action, selMode, ctrl: boolean; + action, selMode, ctrl, ctrlonly: boolean; skip: TCharSkip; begin LastKeyPressTick:= RealTicks; @@ -806,6 +807,7 @@ selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; + ctrlonly:= ctrl and ((modifier and nonStateMask and (not (KMOD_LCTRL or KMOD_RCTRL))) = 0); skip:= none; case Sym of @@ -965,7 +967,7 @@ SDLK_a: begin // select all - if ctrl then + if ctrlonly then begin ResetSelection(); cursorPos:= 0; @@ -979,7 +981,7 @@ SDLK_c: begin // copy - if ctrl then + if ctrlonly then CopySelectionToClipboard() else action:= false; @@ -987,7 +989,7 @@ SDLK_v: begin // paste - if ctrl then + if ctrlonly then begin DeleteSelected(); PasteFromClipboard(); @@ -998,7 +1000,7 @@ SDLK_x: begin // cut - if ctrl then + if ctrlonly then begin CopySelectionToClipboard(); DeleteSelected();