mirror of https://gitlab.com/basile.b/dexed.git
fix, brace auto-clsoing, a case where it was not triggered
new line after { followed by blanks
This commit is contained in:
parent
f67c05a83b
commit
48a8ea5bb9
|
@ -1482,6 +1482,8 @@ end;
|
||||||
|
|
||||||
{$REGION user input ------------------------------------------------------------}
|
{$REGION user input ------------------------------------------------------------}
|
||||||
procedure TCESynMemo.KeyDown(var Key: Word; Shift: TShiftState);
|
procedure TCESynMemo.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
|
var
|
||||||
|
line: string;
|
||||||
begin
|
begin
|
||||||
case Key of
|
case Key of
|
||||||
VK_BACK: if fCallTipWin.Visible and (CaretX > 1)
|
VK_BACK: if fCallTipWin.Visible and (CaretX > 1)
|
||||||
|
@ -1489,20 +1491,22 @@ begin
|
||||||
decCallTipsLvl;
|
decCallTipsLvl;
|
||||||
VK_RETURN:
|
VK_RETURN:
|
||||||
begin
|
begin
|
||||||
|
line := LineText;
|
||||||
if (fAutoCloseCurlyBrace in [autoCloseOnNewLineEof .. autoCloseOnNewLineLexically]) then
|
if (fAutoCloseCurlyBrace in [autoCloseOnNewLineEof .. autoCloseOnNewLineLexically]) then
|
||||||
case fAutoCloseCurlyBrace of
|
case fAutoCloseCurlyBrace of
|
||||||
autoCloseOnNewLineAlways: if (CaretX > 1) and (LineText[LogicalCaretXY.X - 1] = '{') then
|
autoCloseOnNewLineAlways: if (CaretX > 1) and (line[LogicalCaretXY.X - 1] = '{') then
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
curlyBraceCloseAndIndent(self);
|
curlyBraceCloseAndIndent(self);
|
||||||
end;
|
end;
|
||||||
autoCloseOnNewLineEof: if (CaretX > 1) and (LineText[LogicalCaretXY.X - 1] = '{') then
|
autoCloseOnNewLineEof: if (CaretX > 1) and (line[LogicalCaretXY.X - 1] = '{') then
|
||||||
if (CaretY = Lines.Count) and (CaretX = LineText.length+1) then
|
if (CaretY = Lines.Count) and (CaretX = line.length+1) then
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
curlyBraceCloseAndIndent(self);
|
curlyBraceCloseAndIndent(self);
|
||||||
end;
|
end;
|
||||||
autoCloseOnNewLineLexically: if LogicalCaretXY.X - 1 >= lineText.length then
|
autoCloseOnNewLineLexically: if (LogicalCaretXY.X - 1 >= line.length)
|
||||||
|
or isBlank(line[LogicalCaretXY.X .. line.length]) then
|
||||||
begin
|
begin
|
||||||
fLexToks.Clear;
|
fLexToks.Clear;
|
||||||
lex(lines.Text, fLexToks);
|
lex(lines.Text, fLexToks);
|
||||||
|
|
Loading…
Reference in New Issue