fix #31 - case where brace auto close is triggered while in comment

This commit is contained in:
Basile Burg 2020-04-24 21:00:17 +02:00
parent f6570e7e2d
commit b730a4ed52
1 changed files with 12 additions and 17 deletions

View File

@ -3525,7 +3525,6 @@ procedure TDexedMemo.KeyDown(var Key: Word; Shift: TShiftState);
var
line: string;
ddc: char;
lxd: boolean;
ccb: TBraceCloseOption;
begin
case Key of
@ -3543,24 +3542,9 @@ begin
line := LineText;
if [ssCtrl] <> Shift then
begin
lxd := false;
if ((LogicalCaretXY.X - 1 >= line.length) or
isBlank(line[LogicalCaretXY.X .. line.length])) then
begin
lexWholeText([TLexOption.lxoNoWhites, TLexOption.lxoNoComments]);
lxd := true;
ccb := lexCanCloseBrace;
if ccb <> braceCloseInvalid then
begin
Key := 0;
curlyBraceCloseAndIndent((ccb = braceClosePositive) and not (fAutoCloseCurlyBrace = autoCloseNever));
lxd := false;
end;
end;
if (fSmartDdocNewline) then
begin
if not lxd then
lexWholeText();
lexWholeText();
ddc := canInsertLeadingDdocSymbol;
if ddc in ['*', '+'] then
begin
@ -3571,6 +3555,17 @@ begin
exit;
end;
end;
if ((LogicalCaretXY.X - 1 >= line.length) or
isBlank(line[LogicalCaretXY.X .. line.length])) then
begin
lexWholeText([TLexOption.lxoNoWhites, TLexOption.lxoNoComments]);
ccb := lexCanCloseBrace;
if ccb <> braceCloseInvalid then
begin
Key := 0;
curlyBraceCloseAndIndent((ccb = braceClosePositive) and not (fAutoCloseCurlyBrace = autoCloseNever));
end;
end;
end
else shift := [];
end;