mirror of https://gitlab.com/basile.b/dexed.git
editor, auto close on new line, change so that each mode has the 3 same sub modes
This commit is contained in:
parent
612d9afcd0
commit
8d6b6f8b99
|
|
@ -26,8 +26,9 @@ type
|
||||||
autoCloseAtEof,
|
autoCloseAtEof,
|
||||||
autoCloseAlways,
|
autoCloseAlways,
|
||||||
autoCloseLexically,
|
autoCloseLexically,
|
||||||
autoCloseOnNewLine,
|
autoCloseOnNewLineEof,
|
||||||
autoCloseLexicallyOnNewLine
|
autoCloseOnNewLineAlways,
|
||||||
|
autoCloseOnNewLineLexically
|
||||||
);
|
);
|
||||||
|
|
||||||
TIdentifierMatchOptions = set of TIdentifierMatchOption;
|
TIdentifierMatchOptions = set of TIdentifierMatchOption;
|
||||||
|
|
@ -1392,15 +1393,22 @@ 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 [autoCloseOnNewLine, autoCloseLexicallyOnNewLine])
|
if (fAutoCloseCurlyBrace in [autoCloseOnNewLineEof .. autoCloseOnNewLineLexically])
|
||||||
and (CaretX > 1) and (LineText[CaretX-1] = '{') then
|
and (CaretX > 1) and (LineText[CaretX-1] = '{') then
|
||||||
begin
|
case fAutoCloseCurlyBrace of
|
||||||
if fAutoCloseCurlyBrace = autoCloseOnNewLine then
|
autoCloseOnNewLineAlways:
|
||||||
begin
|
begin
|
||||||
Key := 0;
|
Key := 0;
|
||||||
curlyBraceCloseAndIndent(self);
|
curlyBraceCloseAndIndent(self);
|
||||||
end
|
end;
|
||||||
else begin
|
autoCloseOnNewLineEof:
|
||||||
|
if (CaretY = Lines.Count) and (CaretX = LineText.length+1) then
|
||||||
|
begin
|
||||||
|
Key := 0;
|
||||||
|
curlyBraceCloseAndIndent(self);
|
||||||
|
end;
|
||||||
|
autoCloseOnNewLineLexically:
|
||||||
|
begin
|
||||||
fLexToks.Clear;
|
fLexToks.Clear;
|
||||||
lex(lines.Text, fLexToks);
|
lex(lines.Text, fLexToks);
|
||||||
if lexCanCloseBrace then
|
if lexCanCloseBrace then
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue