add option to eanble completion menu auto close

This commit is contained in:
Basile Burg 2017-06-17 02:49:09 +02:00
parent b8e6fa1874
commit 6996f1f11e
No known key found for this signature in database
GPG Key ID: 1868039F415CB8CF
2 changed files with 7 additions and 3 deletions

View File

@ -56,6 +56,7 @@ type
fOptions2: TSynEditorOptions2;
fMouseOptions: TSynEditorMouseOptions;
fCompletionMenuCaseCare: boolean;
fCompletionMenuAutoClose: boolean;
fCompletionMenuWidth: integer;
fCompletionMenuLines: Byte;
fAutoCloseCurlyBrace: TBraceAutoCloseStyle;
@ -95,6 +96,7 @@ type
property characterSpacing: Integer read fCharSpacing write fCharSpacing default 0;
property closeCompletionCharsWithSpace: AnsiString read fCloseCompletionCharsWithSpace write fCloseCompletionCharsWithSpace;
property closeCompletionChars: AnsiString read fCloseCompletionChars write fCloseCompletionChars;
property completionMenuAutoClose: boolean read fCompletionMenuAutoClose write fCompletionMenuAutoClose;
property completionMenuCaseCare: boolean read fCompletionMenuCaseCare write fCompletionMenuCaseCare;
property completionMenuLines: byte read fCompletionMenuLines write setCompletionMenuLines;
property completionMenuWidth: integer read fCompletionMenuWidth write fCompletionMenuWidth;
@ -300,6 +302,7 @@ begin
fCompletionMenuWidth:=srcopt.fCompletionMenuWidth;
fCompletionMenuLines:=srcopt.fCompletionMenuLines;
fCompletionMenuCaseCare:=srcopt.fCompletionMenuCaseCare;
fCompletionMenuAutoClose:= srcopt.fCompletionMenuAutoClose;
fAutoDotDelay:=srcopt.fAutoDotDelay;
fDDocDelay:=srcopt.fDDocDelay;
fFont.Assign(srcopt.fFont);
@ -693,6 +696,7 @@ begin
anEditor.smartDdocNewline:= fSmartDdocNewline;
anEditor.insertPlusDdoc:= fInsertPlusDdoc;
anEditor.autoCallCompletion:= fAutoCallCompletion;
anEditor.completionMenuAutoClose:=fCompletionMenuAutoClose;
cs := [];
for c in fCloseCompletionCharsWithSpace do

View File

@ -185,6 +185,7 @@ type
fAutoCallCompletion: boolean;
fCloseCompletionCharsWithSpace: TSysCharSet;
fCloseCompletionChars: TSysCharSet;
fCompletionMenuAutoClose: boolean;
procedure decCallTipsLvl;
procedure setMatchOpts(value: TIdentifierMatchOptions);
function getMouseBytePosition: Integer;
@ -315,6 +316,7 @@ type
property autoCallCompletion: boolean read fAutoCallCompletion write fAutoCallCompletion;
property closeCompletionCharsWithSpace: TSysCharSet read fCloseCompletionCharsWithSpace write fCloseCompletionCharsWithSpace;
property closeCompletionChars: TSysCharSet read fCloseCompletionChars write fCloseCompletionChars;
property completionMenuAutoClose: boolean read fCompletionMenuAutoClose write fCompletionMenuAutoClose;
end;
TSortDialog = class(TForm)
@ -2067,10 +2069,8 @@ begin
end;
procedure TCESynMemo.completionDeleteKey(sender: TObject);
var
e: string;
begin
if fCompletion.CurrentString.length < 2 then
if fCompletionMenuAutoClose and (fCompletion.CurrentString.length < 2) then
fCompletion.TheForm.Close;
end;