mirror of https://gitlab.com/basile.b/dexed.git
editor, brace auto-closing, new line, lexically, not restricted to new line after open brace
This commit is contained in:
parent
21d45c877f
commit
8d71f9d4db
|
@ -789,6 +789,13 @@ begin
|
||||||
break;
|
break;
|
||||||
i += 1;
|
i += 1;
|
||||||
end;
|
end;
|
||||||
|
if (beg[i] <> '{') and (i > 1) then
|
||||||
|
begin
|
||||||
|
if (eoTabsToSpaces in editor.Options) then
|
||||||
|
i -= editor.TabWidth
|
||||||
|
else
|
||||||
|
i -= 1;
|
||||||
|
end;
|
||||||
i -= 1;
|
i -= 1;
|
||||||
editor.BeginUndoBlock;
|
editor.BeginUndoBlock;
|
||||||
editor.CommandProcessor(ecInsertLine, '', nil);
|
editor.CommandProcessor(ecInsertLine, '', nil);
|
||||||
|
@ -1007,7 +1014,7 @@ begin
|
||||||
end;
|
end;
|
||||||
CaretXY := cp;
|
CaretXY := cp;
|
||||||
end;
|
end;
|
||||||
{$ENDREGIOn}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION DDoc & CallTip --------------------------------------------------------}
|
{$REGION DDoc & CallTip --------------------------------------------------------}
|
||||||
procedure TCESynMemo.InitHintWins;
|
procedure TCESynMemo.InitHintWins;
|
||||||
|
@ -1428,15 +1435,14 @@ procedure TCESynMemo.KeyDown(var Key: Word; Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
if Key = VK_RETURN then
|
if Key = VK_RETURN then
|
||||||
begin
|
begin
|
||||||
if (fAutoCloseCurlyBrace in [autoCloseOnNewLineEof .. autoCloseOnNewLineLexically])
|
if (fAutoCloseCurlyBrace in [autoCloseOnNewLineEof .. autoCloseOnNewLineLexically])then
|
||||||
and (CaretX > 1) and (LineText[LogicalCaretXY.X - 1] = '{') then
|
|
||||||
case fAutoCloseCurlyBrace of
|
case fAutoCloseCurlyBrace of
|
||||||
autoCloseOnNewLineAlways:
|
autoCloseOnNewLineAlways: if (CaretX > 1) and (LineText[LogicalCaretXY.X - 1] = '{') then
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
curlyBraceCloseAndIndent(self);
|
curlyBraceCloseAndIndent(self);
|
||||||
end;
|
end;
|
||||||
autoCloseOnNewLineEof:
|
autoCloseOnNewLineEof: if (CaretX > 1) and (LineText[LogicalCaretXY.X - 1] = '{') then
|
||||||
if (CaretY = Lines.Count) and (CaretX = LineText.length+1) then
|
if (CaretY = Lines.Count) and (CaretX = LineText.length+1) then
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
|
|
Loading…
Reference in New Issue