@@ -14,7 +14,7 @@ interface
1414type
1515 TDelphiAIDevIDEShortcuts = class (TNotifierObject, IOTAKeyboardBinding)
1616 private
17- procedure KeyProcBlockReturn (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
17+ // procedure KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
1818 procedure KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
1919 protected
2020 function GetBindingType : TBindingType;
@@ -38,8 +38,8 @@ implementation
3838
3939procedure RegisterSelf ;
4040begin
41- // if Index < 0 then
42- // Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
41+ if Index < 0 then
42+ Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
4343end ;
4444
4545procedure UnRegisterSelf ;
@@ -79,36 +79,41 @@ function TDelphiAIDevIDEShortcuts.GetName: string;
7979
8080procedure TDelphiAIDevIDEShortcuts.BindKeyboard (const BindingServices: IOTAKeyBindingServices);
8181begin
82- if TUtilsOTA.CurrentProjectIsDelphiAIDeveloperDPROJ then
83- Exit;
82+ // if TUtilsOTA.CurrentProjectIsDelphiAIDeveloperDPROJ then
83+ // Exit;
8484
85- Exit;
86- BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil );
85+ // BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil);
8786 BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [ssAlt])], Self.KeyProcBlockReturnAndAlt, nil );
8887end ;
8988
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;
9797
9898procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
9999var
100100 LTextCurrentLineOrBlock: string;
101101begin
102- // TUtils.AddLog('Enter and Alt' + GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
102+ if KeyCode <> Shortcut(VK_RETURN, [ssAlt]) then
103+ Exit;
103104
104- LTextCurrentLineOrBlock := GetCurrentLineOrBlock(CnOtaGetTopMostEditView);
105+ // LTextCurrentLineOrBlock := Context.EditBuffer.EditBlock.Text;
106+ LTextCurrentLineOrBlock := GetCurrentLineOrBlock(CnOtaGetTopMostEditView).Trim;
105107 if LTextCurrentLineOrBlock.Trim.IsEmpty then
106108 Exit;
107109
110+ if copy(LTextCurrentLineOrBlock, 1 , 2 ) = ' //' then
111+ LTextCurrentLineOrBlock := copy(LTextCurrentLineOrBlock, 3 , LTextCurrentLineOrBlock.Length);
112+
108113 DelphiAIDev.Chat.View .DelphiAIDevChatView.QuestionOnShow := LTextCurrentLineOrBlock;
109114 DelphiAIDev.Chat.View .DelphiAIDevChatViewShowDockableForm;
110115
111- BindingResult := krNextProc ; // krUnhandled ;
116+ BindingResult := TKeyBindingResult.krUnhandled ; // krNextProc ;
112117end ;
113118
114119initialization
0 commit comments