editor, auto close on new line, change so that each mode has the 3 same sub modes

This commit is contained in:
Basile Burg 2016-03-13 22:09:07 +01:00
parent 612d9afcd0
commit 8d6b6f8b99
1 changed files with 15 additions and 7 deletions

View File

@ -26,8 +26,9 @@ type
autoCloseAtEof,
autoCloseAlways,
autoCloseLexically,
autoCloseOnNewLine,
autoCloseLexicallyOnNewLine
autoCloseOnNewLineEof,
autoCloseOnNewLineAlways,
autoCloseOnNewLineLexically
);
TIdentifierMatchOptions = set of TIdentifierMatchOption;
@ -1392,15 +1393,22 @@ procedure TCESynMemo.KeyDown(var Key: Word; Shift: TShiftState);
begin
if Key = VK_RETURN then
begin
if (fAutoCloseCurlyBrace in [autoCloseOnNewLine, autoCloseLexicallyOnNewLine])
if (fAutoCloseCurlyBrace in [autoCloseOnNewLineEof .. autoCloseOnNewLineLexically])
and (CaretX > 1) and (LineText[CaretX-1] = '{') then
begin
if fAutoCloseCurlyBrace = autoCloseOnNewLine then
case fAutoCloseCurlyBrace of
autoCloseOnNewLineAlways:
begin
Key := 0;
curlyBraceCloseAndIndent(self);
end
else begin
end;
autoCloseOnNewLineEof:
if (CaretY = Lines.Count) and (CaretX = LineText.length+1) then
begin
Key := 0;
curlyBraceCloseAndIndent(self);
end;
autoCloseOnNewLineLexically:
begin
fLexToks.Clear;
lex(lines.Text, fLexToks);
if lexCanCloseBrace then