From ce57c24b28a54264f837ac3f736bdc47b830232d Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Tue, 2 May 2017 21:08:14 +0200 Subject: [PATCH] editor, allow to validate completion with TAB --- docs/widgets_editor.md | 2 +- src/ce_synmemo.pas | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/docs/widgets_editor.md b/docs/widgets_editor.md index a2fab3f3..d55ce0ef 100644 --- a/docs/widgets_editor.md +++ b/docs/widgets_editor.md @@ -125,5 +125,5 @@ The shortcuts are editable in the [shortcut editor](options_shortcuts_editor), u - **lineNumberEvery**: Sets the frequency of the line numbers in the gutter. - **phobosDocRoot**: Sets the location of the standard library html documentation. This is used when F1 is pressed. The value can be a local folder or an http address. - **plusDdoc**: Sets if instead of `*`, `+` are used in the comment produced by the command _Insert DDoc Template_. -- **resetFontSize**: When checked and if the font size is modified then the font size is resets in all the documents that are opened. The option can be disabled in order to keep the current zoom ration. +- **resetFontSize**: When checked and if the font size is modified then the font size is resets in all the documents that are opened. The option can be disabled in order to keep the current zoom ratio. - **smartDdocNewLine**: Allow the auto insertion of a leading `*` or a `+` while writing documentation comments. diff --git a/src/ce_synmemo.pas b/src/ce_synmemo.pas index 42d7309f..b323863a 100644 --- a/src/ce_synmemo.pas +++ b/src/ce_synmemo.pas @@ -201,6 +201,7 @@ type procedure setAutoDotDelay(value: Integer); procedure completionExecute(sender: TObject); procedure getCompletionList; + procedure completionFormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); function completionItemPaint(const AKey: string; ACanvas: TCanvas;X, Y: integer; Selected: boolean; Index: integer): boolean; procedure completionCodeCompletion(var value: string; SourceValue: string; @@ -744,6 +745,7 @@ begin fCompletion.OnExecute:= @completionExecute; fCompletion.OnCodeCompletion:=@completionCodeCompletion; fCompletion.OnPaintItem:= @completionItemPaint; + fCompletion.TheForm.OnKeyDown:= @completionFormKeyDown; fCompletion.CaseSensitive:=true; TStringList(fCompletion.ItemList).CaseSensitive:=true; fCompletion.LongLineHintType:=sclpNone; @@ -2093,6 +2095,12 @@ begin fLastCompletion := value; end; +procedure TCESynMemo.completionFormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); +begin + if char(key) = #9 then + key := 13; +end; + function TCESynMemo.completionItemPaint(const AKey: string; ACanvas: TCanvas;X, Y: integer; Selected: boolean; Index: integer): boolean; var