@@ -14,7 +14,7 @@ interface
14
14
type
15
15
TDelphiAIDevIDEShortcuts = class (TNotifierObject, IOTAKeyboardBinding)
16
16
private
17
- procedure KeyProcBlockReturn (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
17
+ // procedure KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
18
18
procedure KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
19
19
protected
20
20
function GetBindingType : TBindingType;
@@ -38,8 +38,8 @@ implementation
38
38
39
39
procedure RegisterSelf ;
40
40
begin
41
- // if Index < 0 then
42
- // Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
41
+ if Index < 0 then
42
+ Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
43
43
end ;
44
44
45
45
procedure UnRegisterSelf ;
@@ -79,36 +79,41 @@ function TDelphiAIDevIDEShortcuts.GetName: string;
79
79
80
80
procedure TDelphiAIDevIDEShortcuts.BindKeyboard (const BindingServices: IOTAKeyBindingServices);
81
81
begin
82
- if TUtilsOTA.CurrentProjectIsDelphiAIDeveloperDPROJ then
83
- Exit;
82
+ // if TUtilsOTA.CurrentProjectIsDelphiAIDeveloperDPROJ then
83
+ // Exit;
84
84
85
- Exit;
86
- BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil );
85
+ // BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil);
87
86
BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [ssAlt])], Self.KeyProcBlockReturnAndAlt, nil );
88
87
end ;
89
88
90
- procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturn (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
91
- begin
92
- Exit;
93
-
94
- TUtils.AddLog(GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
95
- BindingResult := krNextProc; // krUnhandled;
96
- end ;
89
+ // procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
90
+ // begin
91
+ // if KeyCode <> Shortcut(VK_RETURN, []) then
92
+ // Exit;
93
+ //
94
+ // TUtils.AddLog(GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
95
+ // BindingResult := TKeyBindingResult.krNextProc; //krUnhandled;
96
+ // end;
97
97
98
98
procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
99
99
var
100
100
LTextCurrentLineOrBlock: string;
101
101
begin
102
- // TUtils.AddLog('Enter and Alt' + GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
102
+ if KeyCode <> Shortcut(VK_RETURN, [ssAlt]) then
103
+ Exit;
103
104
104
- LTextCurrentLineOrBlock := GetCurrentLineOrBlock(CnOtaGetTopMostEditView);
105
+ // LTextCurrentLineOrBlock := Context.EditBuffer.EditBlock.Text;
106
+ LTextCurrentLineOrBlock := GetCurrentLineOrBlock(CnOtaGetTopMostEditView).Trim;
105
107
if LTextCurrentLineOrBlock.Trim.IsEmpty then
106
108
Exit;
107
109
110
+ if copy(LTextCurrentLineOrBlock, 1 , 2 ) = ' //' then
111
+ LTextCurrentLineOrBlock := copy(LTextCurrentLineOrBlock, 3 , LTextCurrentLineOrBlock.Length);
112
+
108
113
DelphiAIDev.Chat.View .DelphiAIDevChatView.QuestionOnShow := LTextCurrentLineOrBlock;
109
114
DelphiAIDev.Chat.View .DelphiAIDevChatViewShowDockableForm;
110
115
111
- BindingResult := krNextProc ; // krUnhandled ;
116
+ BindingResult := TKeyBindingResult.krUnhandled ; // krNextProc ;
112
117
end ;
113
118
114
119
initialization
0 commit comments