prevent validation of the completion on operators

This commit is contained in:
Basile Burg 2020-04-25 03:03:53 +02:00
parent 593b49c695
commit b65bb860e4
2 changed files with 19 additions and 2 deletions

View File

@ -15,6 +15,7 @@
- DUB projects: dependencies specified with _path_ are recognized when their sources are in a sub folder taking as name the package name. (#29)
- DUB runnables: document specific messages were not cleared between two calls to "Run DUB single file package". (#27)
- Editor: case where brace auto close is triggered while in comment. (#31)
- Editor: prevent unexpected validation of properties in certain cases, such as `a.map` giving `a.mangleof` after `!`.
## Other

View File

@ -278,6 +278,7 @@ type
procedure completionDeleteKey(sender: TObject);
procedure getCompletionList;
procedure completionFormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
procedure completionFormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
function completionItemPaint(const AKey: string; ACanvas: TCanvas;X, Y: integer;
Selected: boolean; Index: integer): boolean;
procedure completionCodeCompletion(var value: string; SourceValue: string;
@ -1125,7 +1126,8 @@ begin
fCompletion.OnCodeCompletion:=@completionCodeCompletion;
fCompletion.OnPaintItem:= @completionItemPaint;
fCompletion.OnKeyDelete:= @completionDeleteKey;
fCompletion.TheForm.OnKeyDown:= @completionFormKeyDown;
fCompletion.OnKeyDown:= @completionFormKeyDown;
fCompletion.OnUTF8KeyPress:= @completionFormUTF8KeyPress;
fCompletion.CaseSensitive:=true;
TStringList(fCompletion.ItemList).CaseSensitive:=true;
fCompletion.LongLineHintType:=sclpNone;
@ -2828,7 +2830,6 @@ begin
// these "stinky" lines are necessary because
// the proc is called before deletion is effective
// i.e the deleted char is still there...
// related issues #400 and #398
caretX := caretX - 1;
ExecuteCommand(ecDeleteChar, #0, nil);
caretX := caretX + 1;
@ -2892,6 +2893,21 @@ begin
key := 13;
end;
procedure TDexedMemo.completionFormUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char);
const
s: string = '!()[],<>=+-/*%^|&@;?:{}~';
var
c: char;
begin
for c in s do
if UTF8Key = c then
begin
UTF8Key := #0;
fCompletion.AddCharAtCursor(c);
break;
end
end;
function TDexedMemo.completionItemPaint(const AKey: string; ACanvas: TCanvas;X, Y: integer;
Selected: boolean; Index: integer): boolean;
var