@@ -8,12 +8,13 @@ interface
88 Winapi.Windows,
99 Vcl.Menus,
1010 ToolsAPI,
11- DelphiAIDev.Utils.CnWizard;
11+ DelphiAIDev.Utils.CnWizard,
12+ DelphiAIDev.Chat.View ;
1213
1314type
1415 TDelphiAIDevIDEShortcuts = class (TNotifierObject, IOTAKeyboardBinding)
1516 private
16- // procedure KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
17+ procedure KeyProcBlockReturn (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
1718 procedure KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
1819 protected
1920 function GetBindingType : TBindingType;
@@ -37,8 +38,8 @@ implementation
3738
3839procedure RegisterSelf ;
3940begin
40- if Index < 0 then
41- Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
41+ // if Index < 0 then
42+ // Index := TUtilsOTA.GetIOTAKeyboardServices.AddKeyboardBinding(TDelphiAIDevIDEShortcuts.New);
4243end ;
4344
4445procedure UnRegisterSelf ;
@@ -81,19 +82,32 @@ procedure TDelphiAIDevIDEShortcuts.BindKeyboard(const BindingServices: IOTAKeyBi
8182 if TUtilsOTA.CurrentProjectIsDelphiAIDeveloperDPROJ then
8283 Exit;
8384
84- // BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil);
85+ Exit;
86+ BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [])], Self.KeyProcBlockReturn, nil );
8587 BindingServices.AddKeyBinding([Shortcut(VK_RETURN, [ssAlt])], Self.KeyProcBlockReturnAndAlt, nil );
8688end ;
8789
88- // procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturn(const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
89- // begin
90- // TUtils.AddLog(GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
91- // BindingResult := krNextProc; //krUnhandled;
92- // end;
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 ;
9397
9498procedure TDelphiAIDevIDEShortcuts.KeyProcBlockReturnAndAlt (const Context: IOTAKeyContext; KeyCode: TShortcut; var BindingResult: TKeyBindingResult);
99+ var
100+ LTextCurrentLineOrBlock: string;
95101begin
96- TUtils.AddLog(' Enter and Alt' + GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
102+ // TUtils.AddLog('Enter and Alt' + GetCurrentLineOrBlock(CnOtaGetTopMostEditView));
103+
104+ LTextCurrentLineOrBlock := GetCurrentLineOrBlock(CnOtaGetTopMostEditView);
105+ if LTextCurrentLineOrBlock.Trim.IsEmpty then
106+ Exit;
107+
108+ DelphiAIDev.Chat.View .DelphiAIDevChatView.QuestionOnShow := LTextCurrentLineOrBlock;
109+ DelphiAIDev.Chat.View .DelphiAIDevChatViewShowDockableForm;
110+
97111 BindingResult := krNextProc; // krUnhandled;
98112end ;
99113
0 commit comments