mirror of https://gitlab.com/basile.b/dexed.git
fix #31 - case where brace auto close is triggered while in comment
This commit is contained in:
parent
f6570e7e2d
commit
b730a4ed52
|
@ -3525,7 +3525,6 @@ procedure TDexedMemo.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
var
|
var
|
||||||
line: string;
|
line: string;
|
||||||
ddc: char;
|
ddc: char;
|
||||||
lxd: boolean;
|
|
||||||
ccb: TBraceCloseOption;
|
ccb: TBraceCloseOption;
|
||||||
begin
|
begin
|
||||||
case Key of
|
case Key of
|
||||||
|
@ -3543,24 +3542,9 @@ begin
|
||||||
line := LineText;
|
line := LineText;
|
||||||
if [ssCtrl] <> Shift then
|
if [ssCtrl] <> Shift then
|
||||||
begin
|
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
|
if (fSmartDdocNewline) then
|
||||||
begin
|
begin
|
||||||
if not lxd then
|
lexWholeText();
|
||||||
lexWholeText();
|
|
||||||
ddc := canInsertLeadingDdocSymbol;
|
ddc := canInsertLeadingDdocSymbol;
|
||||||
if ddc in ['*', '+'] then
|
if ddc in ['*', '+'] then
|
||||||
begin
|
begin
|
||||||
|
@ -3571,6 +3555,17 @@ begin
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
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
|
end
|
||||||
else shift := [];
|
else shift := [];
|
||||||
end;
|
end;
|
||||||
|
|
Loading…
Reference in New Issue