mirror of https://gitlab.com/basile.b/dexed.git
JumToDefinition and completion menu shortcuts are customizables
using the option editor widget
This commit is contained in:
parent
6e54c83473
commit
2131e51016
|
|
@ -93,7 +93,6 @@ inherited CEEditorWidget: TCEEditorWidget
|
||||||
end
|
end
|
||||||
object mnuedJum2Decl: TMenuItem
|
object mnuedJum2Decl: TMenuItem
|
||||||
Caption = 'Jump to declaration'
|
Caption = 'Jump to declaration'
|
||||||
ShortCut = 24614
|
|
||||||
OnClick = mnuedJum2DeclClick
|
OnClick = mnuedJum2DeclClick
|
||||||
end
|
end
|
||||||
object mnuedCallTip: TMenuItem
|
object mnuedCallTip: TMenuItem
|
||||||
|
|
|
||||||
|
|
@ -299,9 +299,7 @@ begin
|
||||||
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT: updateImperative;
|
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT: updateImperative;
|
||||||
end;
|
end;
|
||||||
if fKeyChanged then
|
if fKeyChanged then
|
||||||
beginDelayedUpdate
|
beginDelayedUpdate;
|
||||||
else if (Key = VK_UP) and (shift = [ssShift,ssCtrl]) then
|
|
||||||
getSymbolLoc;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.memoKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
procedure TCEEditorWidget.memoKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||||
|
|
@ -314,6 +312,9 @@ end;
|
||||||
procedure TCEEditorWidget.memoCmdProcessed(Sender: TObject; var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
procedure TCEEditorWidget.memoCmdProcessed(Sender: TObject; var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||||
begin
|
begin
|
||||||
fLastCommand := Command;
|
fLastCommand := Command;
|
||||||
|
//
|
||||||
|
if Command = ecJumpToDefinition then
|
||||||
|
getSymbolLoc;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCEEditorWidget.memoKeyPress(Sender: TObject; var Key: char);
|
procedure TCEEditorWidget.memoKeyPress(Sender: TObject; var Key: char);
|
||||||
|
|
|
||||||
|
|
@ -143,6 +143,8 @@ type
|
||||||
procedure removeBreakPoint(line: integer);
|
procedure removeBreakPoint(line: integer);
|
||||||
function findBreakPoint(line: integer): boolean;
|
function findBreakPoint(line: integer): boolean;
|
||||||
protected
|
protected
|
||||||
|
procedure DoOnProcessCommand(var Command: TSynEditorCommand; var AChar: TUTF8Char;
|
||||||
|
Data: pointer); override;
|
||||||
procedure MouseLeave; override;
|
procedure MouseLeave; override;
|
||||||
procedure SetVisible(Value: Boolean); override;
|
procedure SetVisible(Value: Boolean); override;
|
||||||
procedure SetHighlighter(const Value: TSynCustomHighlighter); override;
|
procedure SetHighlighter(const Value: TSynCustomHighlighter); override;
|
||||||
|
|
@ -196,6 +198,13 @@ type
|
||||||
|
|
||||||
procedure SetDefaultCoeditKeystrokes(ed: TSynEdit);
|
procedure SetDefaultCoeditKeystrokes(ed: TSynEdit);
|
||||||
|
|
||||||
|
function CustomStringToCommand(const Ident: string; var Int: Longint): Boolean;
|
||||||
|
function CustomCommandToSstring(Int: Longint; var Ident: string): Boolean;
|
||||||
|
|
||||||
|
const
|
||||||
|
ecCompletionMenu = ecUserFirst + 1;
|
||||||
|
ecJumpToDefinition = ecUserFirst + 2;
|
||||||
|
|
||||||
var
|
var
|
||||||
D2Syn: TSynD2Syn; // used as model to set the options when no editor exists.
|
D2Syn: TSynD2Syn; // used as model to set the options when no editor exists.
|
||||||
LfmSyn: TSynLfmSyn; // used to highlight the native project format.
|
LfmSyn: TSynLfmSyn; // used to highlight the native project format.
|
||||||
|
|
@ -460,6 +469,7 @@ begin
|
||||||
fCompletion.CaseSensitive:=false;
|
fCompletion.CaseSensitive:=false;
|
||||||
fCompletion.LongLineHintType:=sclpNone;
|
fCompletion.LongLineHintType:=sclpNone;
|
||||||
fCompletion.TheForm.ShowInTaskBar:=stNever;
|
fCompletion.TheForm.ShowInTaskBar:=stNever;
|
||||||
|
fCompletion.ShortCut:=0;
|
||||||
//
|
//
|
||||||
MouseLinkColor.Style:= [fsUnderline];
|
MouseLinkColor.Style:= [fsUnderline];
|
||||||
with MouseActions.Add do begin
|
with MouseActions.Add do begin
|
||||||
|
|
@ -612,7 +622,6 @@ begin
|
||||||
fDDocWin.Hide;
|
fDDocWin.Hide;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TCESynMemo.getCallTips();
|
procedure TCESynMemo.getCallTips();
|
||||||
begin
|
begin
|
||||||
showCallTips;
|
showCallTips;
|
||||||
|
|
@ -641,6 +650,17 @@ begin
|
||||||
getCompletionList;
|
getCompletionList;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCESynMemo.DoOnProcessCommand(var Command: TSynEditorCommand;
|
||||||
|
var AChar: TUTF8Char; Data: pointer);
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if Command = ecCompletionMenu then
|
||||||
|
begin
|
||||||
|
fCanAutoDot:=false;
|
||||||
|
fCompletion.Execute('', ClientToScreen(point(CaretXPix, CaretYPix + Font.Size)));
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCESynMemo.getCompletionList;
|
procedure TCESynMemo.getCompletionList;
|
||||||
begin
|
begin
|
||||||
if not DcdWrapper.available then exit;
|
if not DcdWrapper.available then exit;
|
||||||
|
|
@ -977,8 +997,29 @@ begin
|
||||||
AddKey(ecColSelEditorBottom, VK_END, [ssAlt, ssShift,ssCtrl], 0, []);
|
AddKey(ecColSelEditorBottom, VK_END, [ssAlt, ssShift,ssCtrl], 0, []);
|
||||||
AddKey(ecSynPSyncroEdStart, ord('E'), [ssCtrl], 0, []);
|
AddKey(ecSynPSyncroEdStart, ord('E'), [ssCtrl], 0, []);
|
||||||
AddKey(ecSynPSyncroEdEscape, ord('E'), [ssCtrl, ssShift], 0, []);
|
AddKey(ecSynPSyncroEdEscape, ord('E'), [ssCtrl, ssShift], 0, []);
|
||||||
|
AddKey(ecCompletionMenu, ord(' '), [ssCtrl], 0, []);
|
||||||
|
AddKey(ecJumpToDefinition, VK_UP, [ssCtrl,ssShift], 0, []); // goto def
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CustomStringToCommand(const Ident: string; var Int: Longint): Boolean;
|
||||||
|
begin
|
||||||
|
case Ident of
|
||||||
|
'ecCompletionMenu': begin Int := ecCompletionMenu; exit(true); end;
|
||||||
|
'ecJumpToDeclaration': begin Int := ecJumpToDefinition; exit(true); end;
|
||||||
|
else exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function CustomCommandToSstring(Int: Longint; var Ident: string): Boolean;
|
||||||
|
begin
|
||||||
|
case Int of
|
||||||
|
ecCompletionMenu: begin Ident := 'ecCompletionMenu'; exit(true); end;
|
||||||
|
ecJumpToDefinition: begin Ident := 'ecJumpToDeclaration'; exit(true); end;
|
||||||
|
else exit(false);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
|
||||||
{$REGION user input ------------------------------------------------------------}
|
{$REGION user input ------------------------------------------------------------}
|
||||||
|
|
@ -1162,6 +1203,8 @@ initialization
|
||||||
LfmSyn.StringAttri.Foreground := clBlue;
|
LfmSyn.StringAttri.Foreground := clBlue;
|
||||||
//
|
//
|
||||||
TCEEditorHintWindow.FontSize := 10;
|
TCEEditorHintWindow.FontSize := 10;
|
||||||
|
//
|
||||||
|
RegisterKeyCmdIdentProcs(@CustomStringToCommand, @CustomCommandToSstring);
|
||||||
finalization
|
finalization
|
||||||
D2Syn.Free;
|
D2Syn.Free;
|
||||||
LfmSyn.Free;
|
LfmSyn.Free;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue