equal
deleted
inserted
replaced
792 end; |
792 end; |
793 end; |
793 end; |
794 |
794 |
795 procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); |
795 procedure KeyPressChat(Key, Sym: Longword; Modifier: Word); |
796 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
796 const firstByteMark: array[0..3] of byte = (0, $C0, $E0, $F0); |
|
797 nonStateMask = (not (KMOD_NUM or KMOD_CAPS)); |
797 var i, btw, index: integer; |
798 var i, btw, index: integer; |
798 utf8: shortstring; |
799 utf8: shortstring; |
799 action, selMode, ctrl: boolean; |
800 action, selMode, ctrl, ctrlonly: boolean; |
800 skip: TCharSkip; |
801 skip: TCharSkip; |
801 begin |
802 begin |
802 LastKeyPressTick:= RealTicks; |
803 LastKeyPressTick:= RealTicks; |
803 action:= true; |
804 action:= true; |
804 |
805 |
805 CheckPasteBuffer(); |
806 CheckPasteBuffer(); |
806 |
807 |
807 selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; |
808 selMode:= (modifier and (KMOD_LSHIFT or KMOD_RSHIFT)) <> 0; |
808 ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; |
809 ctrl:= (modifier and (KMOD_LCTRL or KMOD_RCTRL)) <> 0; |
|
810 ctrlonly:= ctrl and ((modifier and nonStateMask and (not (KMOD_LCTRL or KMOD_RCTRL))) = 0); |
809 skip:= none; |
811 skip:= none; |
810 |
812 |
811 case Sym of |
813 case Sym of |
812 SDLK_BACKSPACE: |
814 SDLK_BACKSPACE: |
813 begin |
815 begin |
963 // ignore me!!! |
965 // ignore me!!! |
964 end; |
966 end; |
965 SDLK_a: |
967 SDLK_a: |
966 begin |
968 begin |
967 // select all |
969 // select all |
968 if ctrl then |
970 if ctrlonly then |
969 begin |
971 begin |
970 ResetSelection(); |
972 ResetSelection(); |
971 cursorPos:= 0; |
973 cursorPos:= 0; |
972 HandleSelection(true); |
974 HandleSelection(true); |
973 cursorPos:= Length(InputStr.s); |
975 cursorPos:= Length(InputStr.s); |
977 action:= false; |
979 action:= false; |
978 end; |
980 end; |
979 SDLK_c: |
981 SDLK_c: |
980 begin |
982 begin |
981 // copy |
983 // copy |
982 if ctrl then |
984 if ctrlonly then |
983 CopySelectionToClipboard() |
985 CopySelectionToClipboard() |
984 else |
986 else |
985 action:= false; |
987 action:= false; |
986 end; |
988 end; |
987 SDLK_v: |
989 SDLK_v: |
988 begin |
990 begin |
989 // paste |
991 // paste |
990 if ctrl then |
992 if ctrlonly then |
991 begin |
993 begin |
992 DeleteSelected(); |
994 DeleteSelected(); |
993 PasteFromClipboard(); |
995 PasteFromClipboard(); |
994 end |
996 end |
995 else |
997 else |
996 action:= false; |
998 action:= false; |
997 end; |
999 end; |
998 SDLK_x: |
1000 SDLK_x: |
999 begin |
1001 begin |
1000 // cut |
1002 // cut |
1001 if ctrl then |
1003 if ctrlonly then |
1002 begin |
1004 begin |
1003 CopySelectionToClipboard(); |
1005 CopySelectionToClipboard(); |
1004 DeleteSelected(); |
1006 DeleteSelected(); |
1005 end |
1007 end |
1006 else |
1008 else |