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
|
||||
object mnuedJum2Decl: TMenuItem
|
||||
Caption = 'Jump to declaration'
|
||||
ShortCut = 24614
|
||||
OnClick = mnuedJum2DeclClick
|
||||
end
|
||||
object mnuedCallTip: TMenuItem
|
||||
|
|
|
|||
|
|
@ -299,9 +299,7 @@ begin
|
|||
VK_UP, VK_DOWN, VK_LEFT, VK_RIGHT: updateImperative;
|
||||
end;
|
||||
if fKeyChanged then
|
||||
beginDelayedUpdate
|
||||
else if (Key = VK_UP) and (shift = [ssShift,ssCtrl]) then
|
||||
getSymbolLoc;
|
||||
beginDelayedUpdate;
|
||||
end;
|
||||
|
||||
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);
|
||||
begin
|
||||
fLastCommand := Command;
|
||||
//
|
||||
if Command = ecJumpToDefinition then
|
||||
getSymbolLoc;
|
||||
end;
|
||||
|
||||
procedure TCEEditorWidget.memoKeyPress(Sender: TObject; var Key: char);
|
||||
|
|
|
|||
|
|
@ -143,6 +143,8 @@ type
|
|||
procedure removeBreakPoint(line: integer);
|
||||
function findBreakPoint(line: integer): boolean;
|
||||
protected
|
||||
procedure DoOnProcessCommand(var Command: TSynEditorCommand; var AChar: TUTF8Char;
|
||||
Data: pointer); override;
|
||||
procedure MouseLeave; override;
|
||||
procedure SetVisible(Value: Boolean); override;
|
||||
procedure SetHighlighter(const Value: TSynCustomHighlighter); override;
|
||||
|
|
@ -196,6 +198,13 @@ type
|
|||
|
||||
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
|
||||
D2Syn: TSynD2Syn; // used as model to set the options when no editor exists.
|
||||
LfmSyn: TSynLfmSyn; // used to highlight the native project format.
|
||||
|
|
@ -460,6 +469,7 @@ begin
|
|||
fCompletion.CaseSensitive:=false;
|
||||
fCompletion.LongLineHintType:=sclpNone;
|
||||
fCompletion.TheForm.ShowInTaskBar:=stNever;
|
||||
fCompletion.ShortCut:=0;
|
||||
//
|
||||
MouseLinkColor.Style:= [fsUnderline];
|
||||
with MouseActions.Add do begin
|
||||
|
|
@ -612,7 +622,6 @@ begin
|
|||
fDDocWin.Hide;
|
||||
end;
|
||||
|
||||
|
||||
procedure TCESynMemo.getCallTips();
|
||||
begin
|
||||
showCallTips;
|
||||
|
|
@ -641,6 +650,17 @@ begin
|
|||
getCompletionList;
|
||||
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;
|
||||
begin
|
||||
if not DcdWrapper.available then exit;
|
||||
|
|
@ -977,8 +997,29 @@ begin
|
|||
AddKey(ecColSelEditorBottom, VK_END, [ssAlt, ssShift,ssCtrl], 0, []);
|
||||
AddKey(ecSynPSyncroEdStart, ord('E'), [ssCtrl], 0, []);
|
||||
AddKey(ecSynPSyncroEdEscape, ord('E'), [ssCtrl, ssShift], 0, []);
|
||||
AddKey(ecCompletionMenu, ord(' '), [ssCtrl], 0, []);
|
||||
AddKey(ecJumpToDefinition, VK_UP, [ssCtrl,ssShift], 0, []); // goto def
|
||||
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 --------------------------------------------------------------------}
|
||||
|
||||
{$REGION user input ------------------------------------------------------------}
|
||||
|
|
@ -1162,6 +1203,8 @@ initialization
|
|||
LfmSyn.StringAttri.Foreground := clBlue;
|
||||
//
|
||||
TCEEditorHintWindow.FontSize := 10;
|
||||
//
|
||||
RegisterKeyCmdIdentProcs(@CustomStringToCommand, @CustomCommandToSstring);
|
||||
finalization
|
||||
D2Syn.Free;
|
||||
LfmSyn.Free;
|
||||
|
|
|
|||
Loading…
Reference in New Issue